Hallo,
Ik heb een vraagje over het bestel api.
Ik heb hierbij het bestel api van one2xs genomen, en loop tegen een probleem aan.
Als een lid op mijn website een minecraft server besteld, moet er 500 punten van zijn saldo afgaan.
Hoe moet ik dit maken in dit script?
Mvg,
Riick.
Ik heb een vraagje over het bestel api.
Ik heb hierbij het bestel api van one2xs genomen, en loop tegen een probleem aan.
Als een lid op mijn website een minecraft server besteld, moet er 500 punten van zijn saldo afgaan.
Hoe moet ik dit maken in dit script?
Mvg,
Riick.
[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #FF8000]/*******
* Voorbeeldscript voor de werking met de bestel-API voor one2xs
* Meer informatie & documentatie: http://www.one2xs.com/profiel/bestelapi_doc
* Versie: 1.0
* Copyright: one2apps 2013
* Datum: 14 januari 2013
* Laatste wijziging: 14 januari 2013
* Alle rechten voorbehouden.
* Gebruik op eigen risico.
* Misbruik wordt bestraft.
***
* Dit is een voorbeeldscript; je bent vrij om je eigen draai aan het systeem te geven, op voorwaarde dat je je aan de regels houdt.
* Succes ermee!
*******/[/COLOR]
[COLOR= #0000BB]$username[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]# gebruikersnaam op one2xs voor wie gebeld moet worden[/COLOR]
[COLOR= #0000BB]$apicode[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]# vind je hier: http://www.one2xs.com/profiel/bestelapi[/COLOR]
[COLOR= #0000BB]$testmode[/COLOR] [COLOR= #007700]=[/COLOR] true[COLOR= #007700];[/COLOR] [COLOR= #FF8000]# testmodus, bij true worden er geen servers aangemaakt[/COLOR]
[COLOR= #0000BB]$admin_mail[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]jouw@email.adres[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]# jouw emailadres, wordt mail heen gestuurd bij fouten[/COLOR]
[COLOR= #0000BB]$jouw_domein[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]# zet hier je domeinnaam neer als je de stappen bij
# Whitelabel configureren op http://www.one2xs.com/
# profiel/bestelapi_doc hebt gevolgd, je krijgt dan
# http://mc03.jouwdomein.nl/multicraft/ in plaats van
# http://46.249.59.247/multicraft/
#####
#####
##### LET OP!!!!! Laat $jouw_domein leeg als je NIET de stappen bij Whitelabel configureren
##### op http://www.one2xs.com/profiel/bestelapi_doc hebt gevolgd; als je dan TOCH wat invult
##### dan kunnen je klanten niet op Multicraft inloggen en ook niet met hun server verbinden!
#####
##### LET OP!!!!! Lees voordat je met dit systeem begint eerst de technische documentatie. Je
##### vindt de documentatie hier: http://www.one2xs.com/profiel/bestelapi_doc. Veel succes!!!
#####
##### [/COLOR]
[URL="http://www.php.net/error_reporting"]error_reporting[/URL][COLOR= #007700]([/COLOR]E_ALL[COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REQUEST_METHOD[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]POST[/COLOR][COLOR= #007700])
{[/COLOR]
[COLOR= #0000BB]$return[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/file_get_contents"]file_get_contents[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]http://www.one2xs.com/api/bestel/handle?user=[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$username[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]&key=[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/sha1"]sha1[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$apicode[/COLOR][COLOR= #007700]).[/COLOR][COLOR= #DD0000]&product=mc&type=256&whitelabel=2&testmode=[/COLOR][COLOR= #007700].([/COLOR][COLOR= #0000BB]$testmode[/COLOR] [COLOR= #007700]==[/COLOR] true [COLOR= #007700]?[/COLOR] [COLOR= #0000BB]1[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700]).[/COLOR][COLOR= #DD0000]&whitelabel_server=[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$jouw_domein[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$return[/COLOR] [COLOR= #007700]= new[/COLOR] SimpleXMLElement[COLOR= #007700]([/COLOR][COLOR= #0000BB]$return[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$return[/COLOR][COLOR= #007700]->[/COLOR]error[COLOR= #007700]))
{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Er is een fout opgetreden, je bestelling is niet afgerond. Neem contact op met de support[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/mail"]mail[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$admin_mail[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]Fout in de API[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]Een bezoeker met IP [/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REMOTE_ADDR[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000] probeerde op [/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/date"]date[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]d-m-Y H:i:s[/COLOR][COLOR= #007700]).[/COLOR][COLOR= #DD0000] een server te bestellen, maar de API gaf dit terug: [/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$return[/COLOR][COLOR= #007700]->[/COLOR]error[COLOR= #007700]);
}[/COLOR]
[URL="http://www.php.net/else"]else[/URL]
[COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Je server is besteld en direct aangemaakt! De gegevens vind je hieronder:<br /><br />[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<strong>Multicraft</strong>: <a href="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$return[/COLOR][COLOR= #007700]->[/COLOR]channel[COLOR= #007700]->[/COLOR]panel_location[COLOR= #007700].[/COLOR][COLOR= #DD0000]">[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$return[/COLOR][COLOR= #007700]->[/COLOR]channel[COLOR= #007700]->[/COLOR]panel_location[COLOR= #007700].[/COLOR][COLOR= #DD0000]</a><br />[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<strong>Gebruikersnaam</strong>: [/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$return[/COLOR][COLOR= #007700]->[/COLOR]channel[COLOR= #007700]->[/COLOR]panel_user[COLOR= #007700].[/COLOR][COLOR= #DD0000]<br />[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<strong>Wachtwoord</strong>: [/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$return[/COLOR][COLOR= #007700]->[/COLOR]channel[COLOR= #007700]->[/COLOR]panel_pass[COLOR= #007700].[/COLOR][COLOR= #DD0000]<br />[/COLOR][COLOR= #007700];
}
}[/COLOR]
[URL="http://www.php.net/else"]else[/URL]
[COLOR= #007700]{[/COLOR]
?>
Je staat op het punt een Minecraft-server te bestellen met 256MB RAM. Klik op Bestel! om je bestelling af te ronden.<br />
<form action="" method="post">
<input type="submit" value="Bestel!" />
</form>
[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #007700]}[/COLOR]
30:
33:
