Archive for November, 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 …

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 …

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, …

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’ ); // …

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 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 …