här är koden och
här kan du se den live. Hos mig funkar det ibland och ibland inte...
vad är det jag gör för fel?
Testat den både på localhost och webbhotell, med olika webbläsare och är fortfarande samma sak...
PHP-kod:
error_reporting(~0);
ini_set('display_errors', 1);
header("Content-Type: application/json;charset=UTF-8");
header("Accept-Language:sv-se,sv");
header("Accept: application/json");
function get_data($url) {
$ch = curl_init();
$timeout = 5;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, true );
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$data = curl_exec($ch);
curl_close($ch);
return $data;
};
$returned_content = get_data('http://api.arbetsformedlingen.se/platsannons/soklista/kommuner?lanid=10');
echo $returned_content ;