Kaynağa Gözat

Fixes to accomodate cURL options with underscores

Jan Oris 9 yıl önce
ebeveyn
işleme
0d333ee17b
2 değiştirilmiş dosya ile 10 ekleme ve 10 silme
  1. 1 1
      composer.json
  2. 9 9
      src/Ixudra/Curl/Builder.php

+ 1 - 1
composer.json

@@ -1,7 +1,7 @@
 {
     "name": "ixudra/curl",
     "description": "Custom PHP Curl library for the Laravel 5 framework - developed by Ixudra",
-    "version": "6.0.0",
+    "version": "6.0.1",
     "keywords": ["Ixudra", "Laravel", "Curl"],
     "homepage": "http://ixudra.be",
     "license": "MIT",

+ 9 - 9
src/Ixudra/Curl/Builder.php

@@ -6,15 +6,15 @@ class Builder {
     protected $curlObject = null;
 
     protected $curlOptions = array(
-        'RETURN_TRANSFER'       => true,
-        'FAIL_ON_ERROR'         => true,
-        'FOLLOW_LOCATION'       => false,
-        'CONNECT_TIMEOUT'       => '',
+        'RETURNTRANSFER'        => true,
+        'FAILONERROR'           => true,
+        'FOLLOWLOCATION'        => false,
+        'CONNECTTIMEOUT'        => '',
         'TIMEOUT'               => 30,
-        'USER_AGENT'            => '',
+        'USERAGENT'             => '',
         'URL'                   => '',
         'POST'                  => false,
-        'HTTP_HEADER'           => array(),
+        'HTTPHEADER'            => array(),
     );
 
     protected $packageOptions = array(
@@ -115,7 +115,7 @@ class Builder {
      */
     public function withHeader($header)
     {
-        $this->curlOptions[ 'HTTP_HEADER' ][] = $header;
+        $this->curlOptions[ 'HTTPHEADER' ][] = $header;
     }
 
     /**
@@ -157,7 +157,7 @@ class Builder {
             $parameters = json_encode($parameters);
         }
 
-        $this->curlOptions[ 'POST_FIELDS' ] = $parameters;
+        $this->curlOptions[ 'POSTFIELDS' ] = $parameters;
     }
 
 //    /**
@@ -221,7 +221,7 @@ class Builder {
         foreach( $this->curlOptions as $key => $value ) {
             $array_key = constant( 'CURLOPT_' . $key );
 
-            if( $key == 'POST_FIELDS' && is_array( $value ) ) {
+            if( $key == 'POSTFIELDS' && is_array( $value ) ) {
                 $results[ $array_key ] = http_build_query( $value, null, '&' );
             } else {
                 $results[ $array_key ] = $value;