I am using the PHP and parsing url content from web and I know two method are there for that file_get_contents(url) and curl. I know we have more option with curl so i am using that But i just wanted to know the process behind the curl. How it works when we make a curl request from scrach in brief
The PHP cURL package just exposes the cURL/libcurl API (which are written in C) in PHP. cURL is really useful for moving data across all sorts of protocols, and has a lot of nice options. On the other hand, file_get_contents is one of the base PHP file operations, and it relies on the kernel to try to find the resource requested. In general, cURL will be a better choice, though often it takes a few more lines of code. One issue with file_get_contents() is that in some cases the connection is left open after the request is made, so the function call will block the script until the request times out and you may see a lot of lag.
References:
http://php.net/manual/en/book.curl.php
http://en.wikipedia.org/wiki/CURL
http://www.php.net/manual/en/ref.filesystem.php
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With