fsocketopen/curl/file_get_contents contrast
fsocketopen |
is a lower-level call, a socket call that belongs to the network system |
1, Fsockopen returns data that has not been processed, including the length of the data and the terminator of the data 2, can be set based on UDP or TCP protocol to interact |
Curl |
Curl through the packaging to support HTTPS authentication, HTTP Post/put method, cookies, etc., the function is very powerful |
1, Curl returns the processed content 2, auto-cache DNS query information, the same domain name only once query performance and efficiency high 3, support get, post multiple ways request |
fopen/file_get_contents |
Each request will be re-made to the DNS query, and the DNS information is not cached. is using Http_fopen_wrapper and is not keeplive. |
1, low efficiency 2, only get data via get |
The above describes the classic crawl network data method Efficiency analysis (fsockopen/curl/file_get_contents), including the file_get_contents aspects of the content, I hope that the PHP tutorial interested in a friend helpful.