Skip to content

Commit 364d043

Browse files
committed
Add upload file example; Update httpbin.org protocol
1 parent 2fd09c6 commit 364d043

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

examples/put.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
use \Curl\Curl;
55

6-
// curl -X PUT -d "id=1&first_name=Zach&last_name=Borboa" "http://httpbin.org/put"
6+
// curl -X PUT -d "id=1&first_name=Zach&last_name=Borboa" "https://httpbin.org/put"
77
$curl = new Curl();
8-
$curl->put('http://httpbin.org/put', array(
8+
$curl->put('https://httpbin.org/put', array(
99
'id' => 1,
1010
'first_name' => 'Zach',
1111
'last_name' => 'Borboa',

examples/upload_file.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
require '../src/Curl/Curl.php';
3+
4+
use \Curl\Curl;
5+
6+
$myfile = curl_file_create('cats.jpg', 'image/png', 'test_name');
7+
8+
$curl = new Curl();
9+
$curl->post('https://httpbin.org/post', array(
10+
'myfile' => $myfile,
11+
));
12+
13+
if ($curl->error) {
14+
echo 'Error: ' . $curl->error_message . "\n";
15+
} else {
16+
echo 'Success' . "\n";
17+
}

0 commit comments

Comments
 (0)