so the problem is Curl return 404 error for this link. Work on localhost but not on live server, any idea why this error occur , Thanks.
$url = $this->input->get('https://govid.xyz:2053/embed-r3ym33t0bfc0.html');
$agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36';
$c = curl_init();
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_USERAGENT, $agent);
curl_setopt($c, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($c, CURLOPT_URL, $url);
curl_setopt($c, CURLOPT_NOBODY , false);
curl_setopt($c, CURLOPT_FAILONERROR, true);
curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($c, CURLOPT_SSL_VERIFYHOST , false);
$contents = curl_exec($c);
if (curl_errno($c)) {
$error_msg = curl_error($c);
echo $error_msg;
}else{
echo $contents;
}
curl_close($c);
if (isset($error_msg)) {
// TODO - Handle URL error accordingly
}
source https://stackoverflow.com/questions/67781284/curl-the-requested-url-returned-error-404
Comments
Post a Comment