POST请求如何打击与Content-Type头设置为application/JSON的URL。如何打网址使用的PHP
我的代码返回“请求不是全成”(条件的其他侧)。我是初学者,所以请帮助我理解为什么这不起作用。
代码:
$data_string=json data here;
$ch = curl_init('www.here is url');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
if(curl_exec($ch))
echo "request successfull";
else
echo "request not successfull"
curl_close($ch);
你为什么要送那的HTTPHeader?使用'json_decode($ data_string,真)'应该很好做的工作,不是吗? – Vyktor 2012-02-08 18:21:05
是杰森被罚款实际上这个问题是,我是hitting..they有即将到期的SSL证书的网站。现在寄托都优良,工作.. – Natasha 2012-02-08 19:13:32