Skip to content

Commit

Permalink
v1.0.1: 400 bad request error within execute_profile_request() has be…
Browse files Browse the repository at this point in the history
…en fixed.
  • Loading branch information
ivantcholakov committed Jan 9, 2015
1 parent cdc2267 commit 050cbb3
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion libraries/Gravatar.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* Code repository: @link https://github.com/ivantcholakov/Codeigniter-Gravatar
*
* @version 1.0
* @version 1.0.1
*
* @license The MIT License (MIT)
* @link http://opensource.org/licenses/MIT
Expand Down Expand Up @@ -231,14 +231,29 @@ public function execute_profile_request($email, $format = null) {
CURLOPT_USERAGENT, $this->useragent,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => array(),
CURLOPT_URL => $url,
CURLOPT_TIMEOUT => 3,
);

if (!ini_get('safe_mode') && !ini_get('open_basedir')) {
$options[CURLOPT_FOLLOWLOCATION] = true;
}

curl_setopt_array($ch, $options);

$result = curl_exec($ch);

$code = @ curl_getinfo($ch, CURLINFO_HTTP_CODE);

@ curl_close($ch);

if ($code != 200) {

$this->last_error = GRAVATAR_CANT_CONNECT;
return null;
}

} elseif ($this->allow_url_fopen) {

$url = $this->base_url.$this->create_hash($email).$format;
Expand Down

0 comments on commit 050cbb3

Please sign in to comment.