1
有人能幫我一下捲曲PHP,與本地主機工作,但建立在WEB不使用代碼:對象搬到這裏捲曲PHP
public function curl()
{
$this->channel = curl_init();
// you might want the headers for http codes
curl_setopt($this->channel, CURLOPT_HEADER, true);
curl_setopt($this->channel, CURLOPT_USERAGENT, sprintf("Mozilla/%d.0",rand(4,5)));
curl_setopt($this->channel, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($this->channel, CURLOPT_VERBOSE, true);
curl_setopt($this->channel, CURLOPT_FAILONERROR, true);
curl_setopt($this->channel, CURLOPT_TIMEOUT,60);
curl_setopt($this->channel, CURLOPT_RETURNTRANSFER, true);
curl_setopt($this->channel,CURLOPT_ENCODING,"gzip");
curl_setopt($this->channel, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($this->channel, CURLOPT_SSL_VERIFYPEER, 0);
}
我建立web和錯誤:「對象移動到這裏」 ,但我使用xampp localhost正在工作。
您應該嘗試添加'curl_setopt($ ch,CURLOPT_MAXREDIRS,10);'因爲我們不知道實際發生了什麼,因爲您沒有提供目標URL。 –
我嘗試過,但它仍然錯誤:「對象移到這裏」 –
爲什麼你有重複的選項設置? –