null php string to json

时间:2018-04-14 07:38:07

标签: php json

这是我的代码

$token=file_get_contents("http://127.0.0.1/adsl/token.php?username=1350&password=3dddddddd");

$useragent = "Apache-HttpClient/UNAVAILABLE (java 1.4)";
$url="http://adsl.tci.ir/api/webservice/";
$arrSetHeaders = array(
    "User-Agent: $useragent",
    "Connection: keep-alive",
);
$post="data=&auth=$token&action=GetCustomerInfo&worker=android";

$ch  = curl_init();

curl_setopt($ch, CURLOPT_HTTPHEADER, $arrSetHeaders);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POSTFIELDS,$post);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);


$page= curl_exec($ch);
$page=json_decode($page,true);

$pagenull

但是当代码直接在json_decode(“MY CODE”)中;我没有问题

0 个答案:

没有答案