Curl not json response in php

后端 未结 2 740
心在旅途
心在旅途 2021-01-27 20:23

not getting response using curl. I have put all solution but did not get response.

$ch = curl_init();
$header = array(\'api_key:xxxxxxx         


        
2条回答
  •  时光说笑
    2021-01-27 21:09

    Add this in your code and then check.

    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

    For your used-case you have to change your code.

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL,"https://api.nhs.uk/organisations/FNM60");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $response = curl_exec($ch);
    
    curl_close($ch);
    $result = json_decode($response,true);  
    print_r($result);
    

提交回复
热议问题