Home >Backend Development >PHP Tutorial >The difference between curl and file_get_content in php_PHP tutorial
Until recently, when I was trying to make a web thief program, I discovered that file_get_content could no longer meet the needs. I think that when reading remote content, except that file_get_content is more convenient to use than curl, it is not as good as curl.
Main differences:
After studying, I discovered that curl supports many protocols, including FTP, FTPS, HTTP, HTTPS, GOPHER, TELNET, DICT, FILE and LDAP. In other words, it can do many things that file_get_content cannot do. Curl can achieve remote acquisition and collection of content in PHP; implement FTP upload and download of the PHP web version; implement simulated login; implement interface docking (API), data transmission; implement simulated cookies; download file breakpoint resumption, etc., the function is very powerful .
After understanding some basic uses of curl, I found that it is not difficult. It is just a little harder to remember some of the setting parameters, but we can just remember a few commonly used ones.
Enable curl:
Because PHP does not support the curl function by default, if you want to use curl, you first need to enable this function in php.ini, that is, remove the semicolon in front of ;extension= php_curl.dll, then save and restart apache/ iis is just fine.
Basic syntax:
http://www.bkjia.com/PHPjc/768141.html