arrays - Why do I get a PHP error 406 when trying to use file_get_contents() function and how to solve it? -


i want json array api. why cant using file_get_contents($g_7_14)?

this error get:

( ! ) warning: file_get_contents(https://example.com:443/api/xxx/yyy?app_ids=666&start_date=2015-07-14&end_date=2015-07-14&auth_token=8scr): failed open stream: http request failed! http/1.1 406 not acceptable in c:\wamp\www\phpexcel\index.php on line 8

and code:

<?php  //494792609      if ( !empty ( $_get['app_id'] ) ) {         $g_7_14 = 'https://example.com:443/api/xxx/yyy?app_ids=666&start_date=2015-07-14&end_date=2015-07-14&auth_token=8scr';         echo $g_7_14.'<br>';          $json_g_7_14 = file_get_contents($g_7_14);          /* $ch = curl_init();          curl_setopt($ch, curlopt_url,$g_7_14);          curl_setopt($ch, curlopt_returntransfer, 1);          curl_setopt($ch,curlopt_httpheader,array('accept-encoding: gzip'));             $xml_response = curl_exec($ch);           var_dump($xml_response);         */          $a_g_7_14 = json_decode($json_g_7_14, true);      }    ?>   <!doctype html> <html> <head>     <title>yh </title> </head> <body>  <form action="">     <input type="text" name="app_id" />     <button type="submin"> submit</button> </form>  <div>      <?php       ?>  </div>   </body> </html> 

you can see in code got curl part commented. didn't work :( !

solved! got token company work with.


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

c# - two queries in same method -