mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-10-07 04:26:58 +00:00
Add additional examples to cover supported request methods
This commit is contained in:
+9
-4
@@ -3,13 +3,18 @@ require __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
use \Curl\Curl;
|
||||
|
||||
// curl -X PUT -d "id=1&first_name=Zach&last_name=Borboa" "https://httpbin.org/put"
|
||||
// curl --request PUT "https://httpbin.org/put" --data "id=1&first_name=Zach&last_name=Borboa"
|
||||
|
||||
$curl = new Curl();
|
||||
$curl->put('https://httpbin.org/put', array(
|
||||
'id' => 1,
|
||||
'id' => '1',
|
||||
'first_name' => 'Zach',
|
||||
'last_name' => 'Borboa',
|
||||
));
|
||||
|
||||
echo 'Data server received via PUT:' . "\n";
|
||||
var_dump($curl->response->form);
|
||||
if ($curl->error) {
|
||||
echo 'Error: ' . $curl->errorCode . ': ' . $curl->errorMessage;
|
||||
} else {
|
||||
echo 'Data server received via PUT:' . "\n";
|
||||
var_dump($curl->response->form);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user