$this->curl = curl_init();
curl_setopt($this->curl, CURLOPT_URL, 'http://something.com/send');
curl_setopt($this->curl, CURLOPT_REFERER, 'http://something.com');
curl_setopt($this->curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20100101 Firefox/15.0.1');
curl_setopt($this->curl, CURLOPT_ENCODING, 'gzip, deflate');
curl_setopt($this->curl, CURLOPT_COOKIEFILE, dirname(__FILE__) . '/cookies.txt');
curl_setopt($this->curl, CURLOPT_COOKIEJAR, dirname(__FILE__) . '/cookies.txt');
curl_setopt($this->curl, CURLOPT_HTTPGET, 0);
curl_setopt($this->curl, CURLOPT_POST, 1);
curl_setopt($this->curl, CURLOPT_POSTFIELDS, 'name=john');
curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, 1);
@curl_setopt($this->curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($this->curl, CURLOPT_HTTPPROXYTUNNEL, FALSE);
curl_setopt($this->curl, CURLOPT_PROXY, $this->proxy['0']);
curl_setopt($this->curl, CURLOPT_PROXYPORT, $this->proxy['1']);
curl_setopt($this->curl, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
curl_setopt($this->curl, CURLOPT_PROXYAUTH, CURLAUTH_BASIC);
curl_setopt($this->curl, CURLOPT_PROXYUSERPWD, $this->proxy['2'] . ':' . $this->proxy['3']);
curl_setopt($this->curl, CURLOPT_HEADER, 1);
curl_setopt($this->curl, CURLINFO_HEADER_OUT, 1);
curl_setopt($this->curl, CURLOPT_VERBOSE, 1);$this->website = curl_exec($this->curl);
var_dump(curl_getinfo($this->curl));
var_dump(curl_error($this->curl));
echo $this->website;
だから getinfo は私を示しています: GET http://something.com/send HTTP/1.1
POST http://something.com/send HTTP/1.1の代わりに
プロキシの障害ではありません-プロキシなしで試しました-同じ結果です。
では、なぜ cURL は GET を強制するのでしょうか? 通常の POST リクエストを行う代わりに?