Files
php-curl-class/examples/github_create_gist.php
T
2015-10-23 22:18:16 -07:00

23 lines
443 B
PHP

<?php
require __DIR__ . '/vendor/autoload.php';
use \Curl\Curl;
$content = <<<EOF
<?php
echo 'hello, world';
EOF;
$curl = new Curl();
$curl->post('https://api.github.com/gists', json_encode(array(
'description' => 'PHP-Curl-Class test.',
'public' => 'true',
'files' => array(
'Untitled.php' => array(
'content' => $content,
),
),
)));
echo 'Gist created at ' . $curl->response->html_url . "\n";