forked from eyecatchup/SEOstats
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Updated DefaultSettings to include curl proxy settings
- Use DefaultSettings in HttpRequest helper - Update .gitignore for .idea folder and fix composer.json intendation
- Loading branch information
Showing
4 changed files
with
34 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,5 @@ vendor/ | |
composer.lock | ||
.project | ||
.settings | ||
.DS_Store | ||
.DS_Store | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
<?php | ||
namespace SEOstats\Helper; | ||
|
||
use SEOstats\Config\DefaultSettings; | ||
|
||
/** | ||
* HTTP Request Helper Class | ||
* | ||
* @package SEOstats | ||
* @author Stephan Schmitz <[email protected]> | ||
* @copyright Copyright (c) 2010 - present Stephan Schmitz | ||
* @license http://eyecatchup.mit-license.org/ MIT License | ||
* @updated 2013/05/12 | ||
* @updated 2016/03/17 | ||
*/ | ||
|
||
class HttpRequest | ||
|
@@ -36,6 +38,12 @@ public static function sendRequest($url, $postData = false, $postJson = false) | |
CURLOPT_MAXREDIRS => 2, | ||
CURLOPT_SSL_VERIFYPEER => 0, | ||
)); | ||
if(!empty(DefaultSettings::CURLOPT_PROXY)) { | ||
curl_setopt($ch, CURLOPT_PROXY, DefaultSettings::CURLOPT_PROXY); | ||
} | ||
if(!empty(DefaultSettings::CURLOPT_PROXYUSERPWD)) { | ||
curl_setopt($ch, CURLOPT_PROXYUSERPWD, DefaultSettings::CURLOPT_PROXYUSERPWD); | ||
} | ||
|
||
if (false !== $postData) { | ||
if (false !== $postJson) { | ||
|
@@ -79,6 +87,12 @@ public static function getHttpCode($url) | |
CURLOPT_SSL_VERIFYPEER => 0, | ||
CURLOPT_NOBODY => 1, | ||
)); | ||
if(!empty(DefaultSettings::CURLOPT_PROXY)) { | ||
curl_setopt($ch, CURLOPT_PROXY, DefaultSettings::CURLOPT_PROXY); | ||
} | ||
if(!empty(DefaultSettings::CURLOPT_PROXYUSERPWD)) { | ||
curl_setopt($ch, CURLOPT_PROXYUSERPWD, DefaultSettings::CURLOPT_PROXYUSERPWD); | ||
} | ||
|
||
curl_exec($ch); | ||
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); | ||
|
@@ -104,6 +118,12 @@ public function getFile($url, $file) | |
CURLOPT_SSL_VERIFYPEER => 0, | ||
CURLOPT_FILE => $fp, | ||
)); | ||
if(!empty(DefaultSettings::CURLOPT_PROXY)) { | ||
curl_setopt($ch, CURLOPT_PROXY, DefaultSettings::CURLOPT_PROXY); | ||
} | ||
if(!empty(DefaultSettings::CURLOPT_PROXYUSERPWD)) { | ||
curl_setopt($ch, CURLOPT_PROXYUSERPWD, DefaultSettings::CURLOPT_PROXYUSERPWD); | ||
} | ||
|
||
curl_exec($ch); | ||
curl_close($ch); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters