php怎么禁用curl函数,如何禁用PHP中的curl调试输出

我编写了一个php curl类,如果我执行应该返回内容的方法,它首先返回头部,然后返回内容。所以我不能解析任何XML数据。

我需要禁用这个示例输出。

HTTP/1.1 200 OK

Date: Thu, 01 Apr 2010 20:11:58 GMT

Server: Apache/2.2.9 (Debian) PHP/5.2.6-1+lenny4 with Suhosin-Patch mod_ssl/2.2.9 OpenSSL/0.9.8g

X-Powered-By: PHP/5.2.6-1+lenny4

Set-Cookie: PHPSESSID=44beccf62f87546140d4a0bd24bd28b0; path=/

Expires: Thu, 19 Nov 1981 08:52:00 GMT

Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0

Pragma: no-cache

Transfer-Encoding: chunked

Content-Type: application/xml

这是卷发课

class Test_Curl

{

protected $curl;

protected $headers;

protected $useragent;

protected $url;

protected $testkey;

public function __construct()

{

}

public function setUseraget($useragent)

{

$this->useragent = $useragent;

return $this;

}

public function setApiKey($key)

{

$this->billomatApiKey = $key;

}

private function curlExecGeneral()

{

$result = curl_exec($this->curl);

curl_close($this->curl);

return $result;

}

private function curlInitGeneral($request)

{

$this->curl = curl_init($request);

curl_setopt($this->curl, CURLOPT_HEADER, true);

curl_setopt($this->curl, CURLOPT_HTTPHEADER, array("X-testkey: ".$this->testkey, "Content-Type: application/xml"));

curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, true);

}

public function get($request)

{

$this->curlInitGeneral($request);

curl_setopt ($this->curl, CURLOPT_HTTPGET, true);

return $this->curlExecGeneral();

}

public function post($request, $xml)

{

$this->curlInitGeneral($request);

curl_setopt ($this->curl, CURLOPT_POST, true); //set the Requestmethod to POST

curl_setopt ($this->curl, CURLOPT_POSTFIELDS, $xml); //add the xml data to the Request

return $this->curlExecGeneral();

}

}

?>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值