I want to do a http request with curl but can't get a valid response from the server.
the $url
variable is filled with the string: "http://www.transfermarkt.de/borussia-dortmund/startseite/verein/16/index.html"
function request($url) {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
$statuscode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$statustext = curl_getinfo($ch);
curl_close($ch);
if($statuscode!=200){
echo "HTTP ERROR ".$statuscode."<br>";
echo "<pre>";
echo var_dump($statustext);
echo "</pre>";
return "false";
}
return $result;
}