Wednesday 12 May 2010

How to CURL the site using PHP CURL Spider in your site.

\< ? php
/ * Before Running this Curl. First Goto
*
* 1. Enable the PHP CURL library in you apache configuration.
* 2. First open the "php.ini" file of your apache or php configuration file.
* for example, in Xampp on Windows, goto /xampp/php/php.ini.
* 3. then open that file and find the ";extension=php_curl.dll" and remove the semicolumn(;) from that line and change into "extension=php_curl.dll".
* 4. Finally, Restart the Apache Server.
* 5. Run the following file by providing necessary curl_url and and curled_filename.
* 6. Goto the index-curled.html file to check the curled result.
* * /

$url_to_curl = "http://localhost/mysite/";
$curled_filename = "index-curled.html";

$ch = curl_init($url_to_curl);
$fp = fopen($curled_filename, "w");

curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);

if(!curl_errno($ch))
{
$info = curl_getinfo($ch);
echo 'Took ' . $info['total_time'] . ' seconds to send a request to ' . $info['url'];
}

curl_exec($ch);
curl_close($ch);
fclose($fp);

? >
In Coldfusion CURL CURLING,
We can use the [ cfhttp ] tag for curl.
and [ cffile ] to save the file

No comments:

Post a Comment

Please post any queries and comments here.