多次刷新后phpcurl失去连接
我使用这段代码访问myOwncloud服务器,它工作正常,但是如果我刷新页面,我会得到这个错误“请求的URL返回错误:401” 如果我等5分钟或者其他什么的话,它又能工作了 知道为什么吗多次刷新后phpcurl失去连接,php,curl,Php,Curl,我使用这段代码访问myOwncloud服务器,它工作正常,但是如果我刷新页面,我会得到这个错误“请求的URL返回错误:401” 如果我等5分钟或者其他什么的话,它又能工作了 知道为什么吗 $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $this->url.($this->path ? '/'.$this->path : '')); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); ///
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->url.($this->path ? '/'.$this->path : ''));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); /// 1
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_USERPWD, "$this->username:$this->password");
//PROPFIND request that lists all requested properties.
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PROPFIND');
curl_setopt($ch, CURLOPT_FAILONERROR, true); // Required for HTTP error codes to be reported via our call to curl_error($ch)
$response = curl_exec($ch);
if (false === $response) {
$response = curl_error($ch);
}
curl_close($ch);