【发布时间】:2019-04-22 10:16:58
【问题描述】:
我正在尝试使用 php 中的 curl 从 webservice(nodejs) 获取数据,但我得到的结果是“需要 lang” 我尝试使用以下代码,但在我错的地方不适合我? 这是我的代码
$post = ['lang'=> "593f973dea53161779dd5660",'password'=> "amit123d"];
$ch = curl_init();
$url="http://xxxxxx:8000/api/employer/login";
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$response = curl_exec($ch);
$result = json_decode($response);
echo "<pre>";print_R($result);
【问题讨论】: