Best function used when grabbing body content
2 answers
Using cURL functions you can control timeouts etc. and they are pretty easy to use.
You can use curl_setopt($myCurlResource, CURLOPT_HEADER, true)
to include headers in the return value.
+2
source to share
I believe the best gain from overloading to speed with a function file_get_contents()
, it accepts a string as a URL or local path:
<?php
$body=file_get_contents('http://google.com');
?>
cURL is nice too, has a lot of additional options for sending things like POST variables and cookies, however it is not enabled by default with PHP, so you won't be able to use it in certain public hosting environments.
0