Add Gittip example

This commit is contained in:
Zach Borboa
2014-05-16 23:52:56 -07:00
parent 15a121c0e1
commit 4d6f705f8f
+28
View File
@@ -0,0 +1,28 @@
<?php
require '../src/Curl.class.php';
define('GITTIP_USERNAME', 'XXXXXXXXXX');
define('GITTIP_API_KEY', 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX');
$data = array(
array(
'username' => 'user' . mt_rand(),
'platform' => 'gittip',
'amount' => '0.02',
),
array(
'username' => 'user' . mt_rand(),
'platform' => 'gittip',
'amount' => '0.02',
),
);
$curl = new Curl();
$curl->setHeader('Content-Type', 'application/json');
$curl->setBasicAuthentication(GITTIP_API_KEY);
$curl->post('https://www.gittip.com/' . GITTIP_USERNAME . '/tips.json', json_encode($data));
foreach ($curl->response as $tip) {
echo $tip->amount . ' given to ' . $tip->username . '.' . "\n";
}