Archive for November, 2009
A simple whois/domain availability check using cURL PHP
on November 21, 2009
CURL Register Your domain but check its availability: <?php echo check_domain(‘www.imjan.com’); // Instant Example of using check_domain() function function check_domain($domain) { $data = ‘http://’.$domain; // Create a curl handle to a non-existing location $ch = curl_init($data); // Execute curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_exec($ch); // Check if any error occured if(curl_errno($ch)) { return ‘<span style="color:#22c922">The domain is available!</span>’; } else { return ‘<span style="color:#c92222">The domain …
Deleting records with a limited life time
on November 20, 2009
To remove the expired request tokens here is method: // in the RequestToken model public function deleteExpired() { $this->deleteAll(array(‘RequestToken.modified <= DATE_SUB(NOW(), INTERVAL 24 HOUR)’)); } This snippet performs the following steps: it gets the current date and time, subtracts 24 hours, and then deletes all request tokens whose “modified†value is smaller (i.e. older) or equal to the result of the subtraction. MySQL’s …
Stop CURL to send messages to the SERVER error log
on November 14, 2009
In order to prevent curl sending messages to the server error log, you need to instruct curl to use a temporary file for output on stderr. <?php $gacookie="/askapache/tmp/curl-1.txt"; @touch($gacookie); @chmod($gacookie,0666); if($fp = tmpfile()){ $ch = curl_init("http://www.askapache.com/p.php"); curl_setopt ($ch, CURLOPT_STDERR, $fp); curl_setopt ($ch, CURLOPT_VERBOSE, 2); curl_setopt ($ch, CURLOPT_ENCODING, 0); curl_setopt ($ch, CURLOPT_USERAGENT, ‘Mozilla/5.0′); curl_setopt ($ch, CURLOPT_HTTPHEADER, $FF); curl_setopt ($ch, CURLOPT_COOKIEFILE, $gacookie); curl_setopt ($ch, CURLOPT_COOKIEJAR, …
fopen – Get exact line number data in PHP
on November 3, 2009
Simple example using fopen to read exact line number data: <?php // File From Where you want to read the line number (data) // $filename = ‘file.txt’; if( file_exists($filename) && is_readable($filename) ){ echo readLine($filename, 6); }else{ echo "Sorry! couldn’t read from $filename"; } function readLine($file, $line_num, $delimiter="\n") { // Counter $i = 1; // OPEN FILE $fp = fopen( $file, ‘r’ ); // …
Please explain .frm .myd .myi in mysql?
on November 2, 2009
Each MyISAM table is stored on disk in three files. The files have names that begin with the table name and have an extension to indicate the file type. The ‘.frm’ file stores the table definition. The data file has a ‘.MYD’ (MYData) extension. The index file has a ‘.MYI’ (MYIndex) extension.
SEO – Search Engine Optimization
on November 2, 2009
SEO stands for Search Engine Optimization. SEO is the technique of increasing the amount of visitors to a web-site by ranking high in the search results of a search engine. The higher a web-site ranks in the results of a search, the greater the chance that that site will be visited by a user. SEO helps to ensure that a site is obtainable …

