mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-08-24 12:09:24 +00:00
Remove unnecessary json_encode() on post data when using json content-type
This commit is contained in:
@@ -9,7 +9,8 @@ echo 'hello, world';
|
||||
EOF;
|
||||
|
||||
$curl = new Curl();
|
||||
$curl->post('https://api.github.com/gists', json_encode(array(
|
||||
$curl->setHeader('Content-Type', 'application/json');
|
||||
$curl->post('https://api.github.com/gists', array(
|
||||
'description' => 'PHP-Curl-Class test.',
|
||||
'public' => 'true',
|
||||
'files' => array(
|
||||
@@ -17,6 +18,6 @@ $curl->post('https://api.github.com/gists', json_encode(array(
|
||||
'content' => $content,
|
||||
),
|
||||
),
|
||||
)));
|
||||
));
|
||||
|
||||
echo 'Gist created at ' . $curl->response->html_url . "\n";
|
||||
|
||||
Reference in New Issue
Block a user