title: How to get json from cURL with PHP
body: <p>I'm trying to decode a json obtening by cURL with php like this :</p>
  
  <pre><code>$url = 'https://www.toto.com/api/v1/ads/?apikey=titi&amp;code_postal='.$code_postal.'&amp;type_de_bois='.$type_bois;
  $cURL = curl_init();
  curl_setopt($cURL, CURLOPT_URL, $url);
  curl_setopt($cURL, CURLOPT_HTTPGET, true);
  curl_setopt($cURL, CURLOPT_HTTPHEADER, array(
      'Content-Type: application/json',
      'Accept: application/json'
  ));
  
  $result = curl_exec($cURL);
  curl_close($cURL);
  
  var_dump(json_decode($result, true));
  echo json_decode($result);
  </code></pre>
  
  <p>That returns me that, something which seems to be json :</p>
  
  <blockquote>
    <p>[{"id":"6918","nom":"X","code_postal":"88120","ville":"town","description":"test","logo":"test.png","url":"test","telephone":true},
    [{"id":"6919","nom":"Y","code_postal":"88121","ville":"town1","description":"test","logo":"test.png","url":"test","telephone":true},
    [{"id":"6920","nom":"Z","code_postal":"88122","ville":"town2","description":"test","logo":"test.png","url":"test","telephone":true}]</p>
    
    <p>int(1) 1</p>
  </blockquote>
  
  <p>My question are :
  - Why, without echo or print, the array is printed?
  - Why json_decode doesn't work propely or why it is only one value ("1")?</p>
  
  <p>Thanks a lot for your answer.</p>