CURL - Client URL Library Functions - Stop using fopen
by rajesh[ Edit ] 2007-09-13 11:27:51
I think it is better to use cURL instead of fopen wrappers, file_get_contents(), or even include() when opening a website url.
What we are talking here is about external website pages and not local pages.
.i.e fopen("http://sitename") will be very slow when compared to the usage of cURL.
Some stats from php.net comments
Calculating 50 queries to http://www.flickr.com/.
cURL took 9.550734 seconds.
file_get_contents() took 10.878360 seconds.
Calculating 50 queries to http://www.yahoo.com/.
cURL took 4.729566 seconds.
file_get_contents() took 10.443786 seconds.
Calculating 50 queries to http://www.php.net/.
cURL took 13.136836 seconds.
file_get_contents() took 17.981879 seconds.
Example Code to get content using cURL
$url="http://hiox.org";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$store = curl_exec ($ch);
curl_close ($ch);