jquery - php json from url, "no such file or directory" -
<?php header('cache-control: no-cache, must-revalidate'); header('content-type: application/json'); $jsondata = json_decode(file_get_contents(urlencode('https://chart.googleapis.com/chart?cht=p3&chs=250x100&chd=t:60,40&chl=hello|world&chof=json'))); echo $jsondata; ?>
error: failed open stream: no such file or directory in <b>c:\wamp\www\file.php
i want print result json string can handle jquery ajax. missing? thanks
you realise have space in url (results in 400 google). also, don't want use urlencode()
here.
i'd hazard guess don't want use json_decode()
return object or array.
so, try instead
readfile('https://chart.googleapis.com/chart?cht=p3&chs=250x100&chd=t:60,40&chl=hello|world&chof=json'); exit;
to you're attempting, please pay attention note in manual
a url can used filename function if fopen wrappers have been enabled. see fopen() more details on how specify filename. see supported protocols , wrappers links information abilities various wrappers have, notes on usage, , information on predefined variables may provide.
if cannot configure servers such, you'll want check out curl or sockets extension
Comments
Post a Comment