Add upload file example; Update httpbin.org protocol

This commit is contained in:
Zach Borboa
2015-07-28 17:46:29 -07:00
parent 2fd09c6061
commit 364d043d38
2 changed files with 19 additions and 2 deletions
+2 -2
View File
@@ -3,9 +3,9 @@ require '../src/Curl/Curl.php';
use \Curl\Curl;
// curl -X PUT -d "id=1&first_name=Zach&last_name=Borboa" "http://httpbin.org/put"
// curl -X PUT -d "id=1&first_name=Zach&last_name=Borboa" "https://httpbin.org/put"
$curl = new Curl();
$curl->put('http://httpbin.org/put', array(
$curl->put('https://httpbin.org/put', array(
'id' => 1,
'first_name' => 'Zach',
'last_name' => 'Borboa',
+17
View File
@@ -0,0 +1,17 @@
<?php
require '../src/Curl/Curl.php';
use \Curl\Curl;
$myfile = curl_file_create('cats.jpg', 'image/png', 'test_name');
$curl = new Curl();
$curl->post('https://httpbin.org/post', array(
'myfile' => $myfile,
));
if ($curl->error) {
echo 'Error: ' . $curl->error_message . "\n";
} else {
echo 'Success' . "\n";
}