2017 © Pedro Peláez
 

library curlfile-compat

Compatibility library with CURLFile from PHP 5.5

image

imnotjames/curlfile-compat

Compatibility library with CURLFile from PHP 5.5

  • Friday, June 15, 2018
  • by imnotjames
  • Repository
  • 1 Watchers
  • 2 Stars
  • 2,778 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 1 % Grown

The README.md

CURLFile Compatibility Library

Build Status Coverage Status, (*1)

Compatibility library to add a CURLFile class to older versions of PHP. The RFC has some more information on it as well., (*2)

This class abuses the fact that the PHP CURLOPT_POSTFIELDS option will coerce classes to strings when sending it as data, and outputs the older style of including files in the post data., (*3)

Installation

New school or old school, your choice., (*4)

For a new school installation with Composer simply add it to your list of dependencies., (*5)

If you're kicking it old school you've got to require src/CURLFile.php and src/imnotjames/CURLFILE.php., (*6)

Either way, the non-namespaced CURLFile will only be created if the class doesn't already exist. Same goes for the create_curl_file function., (*7)

Usage

Exactly the same as PHP's CURLFile', (*8)

$handle = curl_init('http://example.com');

$cfile = new CURLFile('puppy.jpg','image/jpeg','puppy_boquet');

// Assign POST data
$data = array('test_file' => $cfile);

curl_setopt($handle, CURLOPT_POST, true);
curl_setopt($handle, CURLOPT_POSTFIELDS, $data);

curl_exec($handle);

The Versions

15/06 2018

dev-master

9999999-dev https://github.com/imnotjames/curlfile-compat

Compatibility library with CURLFile from PHP 5.5

  Sources   Download

MIT

The Development Requires

curl file upload curlfile

28/06 2014

0.0.1

0.0.1.0 https://github.com/imnotjames/curlfile-compat

Compatibility library with CURLFile from PHP 5.5

  Sources   Download

MIT

The Development Requires

curl file upload curlfile