failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found

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: