mercredi 31 octobre 2018

Validate Json - Laravel

Hello I'm new in laravel and have some strange situation:

in laravel api.php I have route

Route::get('/blog', function() {
    $url_query_string = "format=json";
    $request_url = 'https://www.squarespace.com/templates/?' . $url_query_string;
    $ch = curl_init($request_url);
          curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
          curl_setopt($ch, CURLOPT_TIMEOUT, 20);
          curl_setopt($ch, CURLOPT_USERAGENT, 'H.H\'s PHP CURL script');
    $response_body = curl_exec($ch);
    curl_close($ch);


    $res = json_decode($response_body,true);
    echo json_encode($res);
});

so it is working but not gives me validated json it is not correct look at picture

enter image description here

not sure where is a problem?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire