protected function getCurlClient() { $client = new \Buzz\Client\Curl(); $client->setTimeout(5); $client->setVerifyPeer(false); $client->setMaxRedirects(0); $client->setOption(\CURLOPT_CONNECTTIMEOUT, 3); $client->setOption(\CURLOPT_USERAGENT, "baidu-apiclient-php-2.0"); $client->setOption(\CURLOPT_HTTP_VERSION, \CURL_HTTP_VERSION_1_1); $client->setOption(\CURLOPT_POST, false); return $client; }
public function setup() { $browser = new \Buzz\Browser(); $curl = new \Buzz\Client\Curl(); $curl->setOption(CURLOPT_USERAGENT, "WoeidFinder/0.1"); $browser->setClient($curl); $nomatimAdapter = new \Famex\WoeidFinder\Adapters\NomatimAdapter(); $nomatimAdapter->setBrowser($browser); $yqlQueryAdapter = new \Famex\WoeidFinder\Adapters\YqlQueryAdapter(); $yqlQueryAdapter->setBrowser($browser); $this->woeidFinder = new \Famex\WoeidFinder\WoeidFinder(); $this->woeidFinder->setNomatimAdapter($nomatimAdapter); $this->woeidFinder->setYqlQueryAdapter($yqlQueryAdapter); }