private function createClientHttp() { $httpClient = new Curl(); $httpClient->setVerifyPeer(true); $httpClient->setTimeout(10); $httpClient->setMaxRedirects(5); $httpClient->setIgnoreErrors(true); return $httpClient; }
/** * Constructs the client. * * @param string $url The base URL for WebDriver server * * @param Buzz\Client\ClientInterface $client The client to use for * requesting the WebDriver server */ public function __construct($url, ClientInterface $client = null) { if (null === $client) { $client = new Curl(); $client->setTimeout(self::DEFAULT_TIMEOUT); $client->setMaxRedirects(0); } $this->url = $url; $this->client = $client; $this->browsers = array(); }
<?php require __DIR__ . '/vendor/autoload.php'; use Buzz\Browser; use Buzz\Client\Curl; $browser = new Browser(); $client = new Curl(); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($ch, CURLOPT_CAINFO, getcwd() . "/CAcerts/BuiltinObjectToken-EquifaxSecureCA.crt"); $client->setMaxRedirects(0); $browser->setClient($client); $response = $browser->get('https://thepiratebay.mn'); echo $response;
/** * * This code is copied from Ctsmedia\Phpbb\BridgeBundle\PhpBB\Connector * @return Browser */ protected function initContaoRequest() { // Init Request $client = new Curl(); $client->setMaxRedirects(0); $browser = new Browser(); $browser->setClient($client); $cookieListener = new CookieListener(); $browser->addListener($cookieListener); return $browser; }
/** * @return Browser */ protected function initForumRequest($force = false) { // Init Request $client = new Curl(); $client->setMaxRedirects(0); $browser = new Browser(); $browser->setClient($client); $cookieListener = new CookieListener(); $browser->addListener($cookieListener); // We need to make sure that the if the original Request is already coming from the forum, we then are not // allowed to send a request to the forum so we create a login loop for example. if ($force === false && System::getContainer()->get('request_stack')->getCurrentRequest() && System::getContainer()->get('request_stack')->getCurrentRequest()->headers->get('x-requested-with') == 'ContaoPhpbbBridge') { System::log('Bridge Request Recursion detected', __METHOD__, TL_ERROR); throw new TooManyRequestsHttpException(null, 'Internal recursion Bridge requests detected'); } return $browser; }