在我的一个函数中,我分别发送了两个curl请求,但在第二个上,我得到了响应的纯文本输出。这是请求代码:
//Initialize the curl connection
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->_endpoint);
curl_setopt($ch, CURLOPT_HEADER, 0); //No header in the response
curl_setopt($ch, CURLOPT_POST, 1); //Submit through post
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_string); //Post data
curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1); //New connection every time
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //Get response data
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); //Security...
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
//Get a response.
if ( !$response_data = curl_exec($ch) ){
$this->_error ( curl_error ( $ch ) );
curl_close($ch);
return FALSE;
}
//Decode our response
parse_str ( $response_data, $response );
//Close curl
curl_close($ch);
如果我只拨打一个电话,那么每件事都可以。当我进行第二次调用时,我在浏览器上得到一个纯文本输出:
username=my_username&password=my_password&email=my_email%40gmail.com
有什么想法吗?