Difference between revisions of "Integration:api"
From PrometheusIPN Wiki
(→How do I use it?) |
(→getGoal Example) |
||
| Line 34: | Line 34: | ||
===== Examples ===== | ===== Examples ===== | ||
| − | + | NO | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
==== assignPackage Example ==== | ==== assignPackage Example ==== | ||
Revision as of 21:18, 26 August 2016
Dick
NO
List of actions
| Action | getGoal | assignPackage | addCredits | getPackages |
|---|---|---|---|---|
| Hash | No | Yes | Yes | Yes |
| Properties | None | steamid, package | steamid, amount | None |
| Returns | error, cur, total, goal | error, msg | error, msg | error, packages |
Examples
NO
assignPackage Example
assignPackageExample.php
<?php
// Replace everything in uppercase letters with your own information
$source = 'http://yourprometheus.com/api.php?hash=YOUR_HASH&action=assignPackage&package=PACKAGE_ID&steamid=STEAM64_OR_STEAMID';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $source);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSLVERSION,4);
$data = curl_exec($ch);
$error = curl_error($ch);
curl_close ($ch);
if($data === false) {
// Display an error if there is any
die('Curl error: ' . $error);
}
// Decode the data response
$array = json_decode($data, true);
// Display an error if there is any
if($array['error'] == 1){
die($array['msg']);
}
// Display success message
if($array['error'] == 0){
echo($array['msg']);
}
?>