Skip to content
This repository was archived by the owner on Aug 9, 2019. It is now read-only.

Commit 7bf96ce

Browse files
committed
HttpClient: Moved basic curl_setopt() calls to constructor
1 parent f4d6852 commit 7bf96ce

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/HttpClient.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,11 @@ public function __construct()
8383
{
8484
$this->handle = curl_init();
8585

86+
curl_setopt($this->handle, CURLOPT_HEADER, false);
87+
curl_setopt($this->handle, CURLOPT_RETURNTRANSFER, true);
88+
curl_setopt($this->handle, CURLOPT_FOLLOWLOCATION, true);
89+
curl_setopt($this->handle, CURLOPT_HEADERFUNCTION, [$this, 'buffer']);
90+
8691
$this->headers = array(
8792
'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
8893
'Accept-Charset' => 'UTF-8',
@@ -299,11 +304,6 @@ protected function execute($url, array $headers = array())
299304

300305
curl_setopt($this->handle, CURLOPT_HTTPHEADER, $curlheaders);
301306

302-
curl_setopt($this->handle, CURLOPT_HEADER, false);
303-
curl_setopt($this->handle, CURLOPT_RETURNTRANSFER, true);
304-
curl_setopt($this->handle, CURLOPT_FOLLOWLOCATION, true);
305-
curl_setopt($this->handle, CURLOPT_HEADERFUNCTION, [$this, 'buffer']);
306-
307307
$response = curl_exec($this->handle);
308308
if ($response !== false) {
309309
$info = curl_getinfo($this->handle);

0 commit comments

Comments
 (0)