How is 618 sales champion made?Uncover the secret of e-commerce’s “invigorating” hundreds of millions of sales data>>>
Although fopen and file_ get_ Contents can directly get content for URL parameters, sometimes the following errors will occur:
failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
Using curl to get URL data can avoid this kind of error from time to time
function geturldata($url)
{
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT,10);
$content = curl_exec($ch);
return $content;
}
Similar Posts:
- PHP Curl: How to Sending Post JSON Formate Data
- file_get_Contents and fopen return false when requesting HTTPS address: Error content: SSL routes: ssl3_get_server_certificate:certificate verify failed
- failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
- Error 77 when solving PHP curl HTTPS
- How to Solve Curl pass large JSON files Error
- Git: when downloading, if EOF failed: index pack failed occurs because the project is too large
- [daily development record] pycurl Python 3 error (23),’failed writing body (0= 456)
- The docker container reports an error when using the systemctl command
- [Solved] CURL Install Error: GnuTLS: The TLS connection was non-properly terminated. Unable to establish SSL connection.
- How to Solve Error: curl: (56) Recv failure: Connection reset by peer