mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-08-30 12:14:36 +00:00
Add upload file example; Update httpbin.org protocol
This commit is contained in:
+2
-2
@@ -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',
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
Reference in New Issue
Block a user