Php Curl POST不发送数据
我正在尝试连接到一个echosign api,该api以前工作,现在突然停止工作,我尝试过调试,但似乎无法解决它,这是我的代码Php Curl POST不发送数据,php,curl,Php,Curl,我正在尝试连接到一个echosign api,该api以前工作,现在突然停止工作,我尝试过调试,但似乎无法解决它,这是我的代码 public function get_access_token_get() { $echoSign = new EchoSign(); $ch = curl_init('https://secure.echosign.com:443/api/rest/v2/auth/tokens'); curl_setopt($ch, CURLOPT
public function get_access_token_get()
{
$echoSign = new EchoSign();
$ch = curl_init('https://secure.echosign.com:443/api/rest/v2/auth/tokens');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($echoSign->echosign_creds));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
$result = json_decode(curl_exec($ch));
curl_close($ch);
echo "<pre>"; print_r($result); echo "</pre>"; exit();
return $result->accessToken;
}
公共函数get\u access\u token\u get()
{
$echoSign=新echoSign();
$ch=curl\u init('https://secure.echosign.com:443/api/rest/v2/auth/tokens');
curl_setopt($ch,CURLOPT_CUSTOMREQUEST,“POST”);
curl_setopt($ch,CURLOPT_POSTFIELDS,json_encode($echoSign->echoSign_creds));
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch,CURLOPT_HTTPHEADER,array('Content-Type:application/json'));
$result=json_decode(curl_exec($ch));
卷曲关闭($ch);
echo“”;print_r($result);echo“”;exit();
返回$result->accessToken;
}
我已经用其他url测试了你的curl代码,它对它们很好,然后我尝试用其他curl方法调用你的url,它给出了空响应,因此,我认为您应该与echosign支持部门联系,看看有什么问题。您能告诉我们您得到的响应吗?它是空的,完全空的。您是否检查了服务器上的curl是否启用?是的,我检查了,并且启用了它。您是否启用了错误?