Json Decode没有对curl采取任何措施

时间:2018-10-30 13:36:00

标签: php json

我正在尝试解码来自curl调用的json,这就是我在做什么:

package main

import (
    "net/http"
)

func main() {
myFunction(&http.Client{})
}

现在这是我从json解码的curl调用中得到的内容,我无法执行数组列表或打印

$url = "https://api.web.net/login/auth.php";

$curl_post_data = array(
    'username' => 'myuser',
    'password' => '12345'
);

//url-ify the data for the POST
$fields_string = http_build_query($curl_post_data);

//open connection
$ch = curl_init();

//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST, 1);
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);

//execute post
$result = curl_exec($ch);
$obj = json_decode($result);
echo "<pre>";
print_r($obj);
echo "</pre>";


//close connection
curl_close($ch);

我在做什么错?我无法访问entitydata来设置令牌。

0 个答案:

没有答案