Exemple #1
0
 private function _postfields($data)
 {
     if (is_array($data)) {
         if (is_array_multidim($data)) {
             $data = http_build_multi_query($data);
         } else {
             // Fix "Notice: Array to string conversion" when $value in
             // curl_setopt($ch, CURLOPT_POSTFIELDS, $value) is an array
             // that contains an empty array.
             foreach ($data as $key => $value) {
                 if (is_array($value) && empty($value)) {
                     $data[$key] = '';
                 }
             }
         }
     }
     return $data;
 }
Exemple #2
0
 /**
  *
  * @param type $data
  * @return array
  */
 protected function _postFields($data)
 {
     if (is_array($data)) {
         if (is_array_multidim($data)) {
             $data = http_build_multi_query($data);
         } else {
             foreach ($data as $key => $value) {
                 if (is_array($value) && empty($value)) {
                     $data[$key] = '';
                 } elseif (is_string($value) && strpos($value, '@') === 0) {
                     if (class_exists('CURLFile')) {
                         $data[$key] = new CURLFile(substr($value, 1));
                     }
                 }
             }
         }
     }
     return $data;
 }
 private function postfields($data)
 {
     if (is_array($data)) {
         if (is_array_multidim($data)) {
             $data = http_build_multi_query($data);
         } else {
             foreach ($data as $key => $value) {
                 // Fix "Notice: Array to string conversion" when $value in
                 // curl_setopt($ch, CURLOPT_POSTFIELDS, $value) is an array
                 // that contains an empty array.
                 if (is_array($value) && empty($value)) {
                     $data[$key] = '';
                     // Fix "curl_setopt(): The usage of the @filename API for
                     // file uploading is deprecated. Please use the CURLFile
                     // class instead".
                 } elseif (is_string($value) && strpos($value, '@') === 0) {
                     if (class_exists('CURLFile')) {
                         $data[$key] = new CURLFile(substr($value, 1));
                     }
                 }
             }
         }
     }
     return $data;
 }
Exemple #4
0
 private function _postfields($data)
 {
     if (is_array($data)) {
         if (is_array_multidim($data)) {
             $data = http_build_multi_query($data);
         } else {
             foreach ($data as $key => $value) {
                 // Fix "Notice: Array to string conversion" when $value in
                 // curl_setopt($ch, CURLOPT_POSTFIELDS, $value) is an array
                 // that contains an empty array.
                 if (is_array($value) && empty($value)) {
                     $data[$key] = '';
                 } else {
                     if (is_string($value) && strpos($value, '@') === 0) {
                         if (class_exists('CURLFile')) {
                             $data[$key] = new CURLFile(substr($value, 1));
                         }
                     }
                 }
             }
         }
     }
     return $data;
 }