1/10/2010

Solve blank web console on VMware 2.0.x

======Blank Web Console on VMware 2.0.x======


vim /usr/lib/vmware/webAccess/tomcat/apache-tomcat-6.0.16/conf/server.xml


Then search for "compressableMimeType" which is compress javascript, css, etc...

Change it to compressableMimeType="text/html" only. That mean it only compress html.

This is a one way to solve the blank web console on VMware 2.0.x

1/03/2010

Using PHP curl to talk to iTunes

$ch = curl_init();
$timeout = 10;
$useragent = "iTunes/9.02 (Macintosh; U; PPC Mac OS X 10.2";
$header = "X-Apple-Store-Front: 143441-1";
$url = "http://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewTopLegacy?id=25204&popId=30&genreId=36"
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_HTTPHEADER, array($header));
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt ($ch, CURLOPT_USERAGENT, $useragent);
header($header);
$fp = fopen($file,'w+');
curl_setopt($ch, CURLOPT_FILE,$fp);
  
$http_conn = curl_exec($ch);
$info = curl_getinfo($ch);

1/02/2010

Sending email in PHP script using SMTP command

#To connect to server. The fsocketopn will time out after 300
#seconds if the connection failed. The $errno and $errstr
#will contain the error number and the error message if an
#error happens.
$smtp_server = fsockopen("mail.mydomain.com", 25, $errno, $errstr, 300);

if(!$smtp_server){
echo "$errstr ($errno)\r\n";
}

#The fgets() in the areas where the SMTP server will reply your client, the script will then
#wait for the server and not just flood it with data.
$inn = fgets($smtp_server, 1024);

fputs($smtp_server, "HELO mail.mydomain.com\r\n");
$inn = fgets($smtp_server, 1024);

fputs($smtp_server, "MAIL FROM: \r\n");
$inn = fgets($smtp_server, 1024);

fputs($smtp_server, "RCPT TO: \r\n");
$inn = fgets($smtp_server, 1024);

fputs($smtp_server, "DATA\r\n");
$inn = fgets($smtp_server, 1024);

fputs($smtp_server, "From: \r\n");
fputs($smtp_server, "To: \r\n");
fputs($smtp_server, "Subject: Downloads\r\n");
fputs($smtp_server, "\r\n");
fputs($smtp_server, $message."\r\n");
fputs($smtp_server, ".\r\n");
$inn = fgets($smtp_server, 1024);

fputs($smtp_server, "QUIT\n");
$inn = fgets($smtp_server, 1024);

fclose($smtp_server);