Answer the question
In order to leave comments, you need to log in
403 error while parsing?
I can't get data from this site sofifa.com.
Tried through cURL and through file_get_contents (), it gives an error 403.
What are your guesses, why does it not work?
function parse ($url)
{
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
$result = curl_exec($curl);
return $result;
}
echo parse('https://sofifa.com/');
echo file_get_contents('https://sofifa.com/');
Answer the question
In order to leave comments, you need to log in
Good morning.
function parse ($url)
{
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36");
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
$result = curl_exec($curl);
return $result;
}
echo parse('https://sofifa.com/');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question