Skip to content

Commit 61964a9

Browse files
committed
Merge branch 'master' of github.com-php-curl-class:php-curl-class/php-curl-class
* 'master' of github.com-php-curl-class:php-curl-class/php-curl-class: Add Github Gist example
2 parents 96c076c + adcd676 commit 61964a9

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

examples/github_create_gist.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
require '../src/Curl.class.php';
3+
4+
5+
$content = <<<EOF
6+
<?php
7+
echo 'hello, world';
8+
EOF;
9+
10+
$curl = new Curl();
11+
$curl->post('https://api.github.com/gists', json_encode(array(
12+
'description' => 'PHP-Curl-Class test.',
13+
'public' => 'true',
14+
'files' => array(
15+
'Untitled.php' => array(
16+
'content' => $content,
17+
),
18+
),
19+
)));
20+
21+
echo 'Gist created at ' . $curl->response->html_url . "\n";

0 commit comments

Comments
 (0)