php - Getting plain text from json API -
php - Getting plain text from json API -
so have api: http://85.17.32.4:8707/status-json.xsl
and want extract few things it, started off basic:
<?php echo json_decode('http://85.17.32.4:8707/status-json.xsl');
it gave absolutely no result. next try:
<?php $var = json_decode('http://85.17.32.4:8707/status-json.xsl'); var_dump($var);
it retourned null
.
then tried making curl function:
<?php $url = 'http://85.17.32.4:8707/status-json.xsl'; $ch = curl_init(); curl_setopt($ch, curlopt_ssl_verifypeer, false); curl_setopt($ch, curlopt_returntransfer, true); curl_setopt($ch, curlopt_url,$url); $result=curl_exec($ch); curl_close($ch); var_dump(json_decode($result, true));
this returned null. have farther options?
thanks.
yes, have farther options: check json_last_error_msg
, see whether there issue json decoding:
$json = json_decode($result, true); # check if there has been error decoding: if (! isset($json)) { echo "decoding error: " . json_last_error_msg() . php_eol; }
output:
decoding error: syntax error
i.e. there syntax error in json. need tell json provider not providing valid json.
php json xslt
Comments
Post a Comment