mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-08-24 14:29:27 +00:00
1a0e9c1f4b
Filename and envvars were updated, but platform and URL weren't.
30 lines
756 B
PHP
30 lines
756 B
PHP
<?php
|
|
require '../src/Curl/Curl.php';
|
|
|
|
use \Curl\Curl;
|
|
|
|
define('GRATIPAY_USERNAME', 'XXXXXXXXXX');
|
|
define('GRATIPAY_API_KEY', 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX');
|
|
|
|
$data = array(
|
|
array(
|
|
'username' => 'user' . mt_rand(),
|
|
'platform' => 'gratipay',
|
|
'amount' => '0.02',
|
|
),
|
|
array(
|
|
'username' => 'user' . mt_rand(),
|
|
'platform' => 'gratipay',
|
|
'amount' => '0.02',
|
|
),
|
|
);
|
|
|
|
$curl = new Curl();
|
|
$curl->setHeader('Content-Type', 'application/json');
|
|
$curl->setBasicAuthentication(GRATIPAY_API_KEY);
|
|
$curl->post('https://gratipay.com/' . GRATIPAY_USERNAME . '/tips.json', json_encode($data));
|
|
|
|
foreach ($curl->response as $tip) {
|
|
echo $tip->amount . ' given to ' . $tip->username . '.' . "\n";
|
|
}
|