Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: php-curl-class/php-curl-class
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: karboom/php-curl-class
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.
  • 3 commits
  • 1 file changed
  • 2 contributors

Commits on Apr 30, 2014

  1. Copy the full SHA
    5213b46 View commit details

Commits on May 7, 2014

  1. Update Curl.class.php

    karboom committed May 7, 2014
    Copy the full SHA
    d9f465c View commit details

Commits on Oct 14, 2014

  1. Delete Curl.class.php~

    karboom committed Oct 14, 2014
    Copy the full SHA
    0fe161d View commit details
Showing with 7 additions and 1 deletion.
  1. +7 −1 src/Curl.class.php
8 changes: 7 additions & 1 deletion src/Curl.class.php
Original file line number Diff line number Diff line change
@@ -45,6 +45,7 @@ public function __construct()
$this->setOpt(CURLINFO_HEADER_OUT, true);
$this->setOpt(CURLOPT_HEADER, true);
$this->setOpt(CURLOPT_RETURNTRANSFER, true);
$this->setOpt(CURLOPT_TIMEOUT, 5);
}

public function get($url_mixed, $data = array())
@@ -334,6 +335,7 @@ private function postfields($data)
if (is_array_multidim($data)) {
$data = http_build_multi_query($data);
} else {
$need_encode = true;
foreach ($data as $key => $value) {
// Fix "Notice: Array to string conversion" when $value in
// curl_setopt($ch, CURLOPT_POSTFIELDS, $value) is an array
@@ -344,11 +346,15 @@ private function postfields($data)
// file uploading is deprecated. Please use the CURLFile
// class instead".
} elseif (is_string($value) && strpos($value, '@') === 0) {
if (class_exists('CURLFile')) {
$need_encode = false;
if (class_exists('CURLFile')) {
$data[$key] = new CURLFile(substr($value, 1));
}
}
}
if($need_encode){
return http_build_query($data);
}
}
}