Een moment, ik zal het eens bekijken..
Hey klopt, ook bij GLS is opeens niet meer goed:
Bel naar [spatie] en voer deze code in: [spatie] .
Dit kost je 0,00 per [spatie] (totaal dus 0,00).
@ lennard, toevallig de API aangepast?
Codeblok (API.php): 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
if(version_compare(PHP_VERSION, 5.0.0, <))
{
die(PHP 5.0.0 of hoger is vereist);
}
class api
{
private $username; // gebruikersnaam van de persoon op one2xs
private $country; // land van de beller
private $stringtosend; // GET string om naar de one2xs server te sturen
private $headers; // teruggekomen headers door de API class na de request naar de one2xs server
private $body; // teruggekomen body door de API class na de request naar de one2xs server
private $messages; // berichten in de body (see $body)
private $url; // url die door de API wordt aangeroepen
private $action; // actie (init of volt)
private $amount; // bedrag in euros waarvoor de betaling wordt klaargezet
private $testmode; // activiteit van de testmodus (TRUE of FALSE)
public function __construct($username, $country, $action, $amount, $testmode)
{
$this->country = $country;
$this->username = $username;
$this->messages = array();
$this->action = $action;
$this->amount = $amount;
$this->url = ;
$this->testmode = $testmode;
}
public function addParam($key, $value)
{
$this->stringtosend .= urlencode($key).=.urlencode($value).&;
}
public function getStringtosend()
{
return $this->stringtosend;
}
public function doTransaction()
{
$this->addParam(user, $this->username);
$this->addParam(ctry, $this->country);
$this->addParam(actie, $this->action);
$this->addParam(amount, $this->amount);
$this->addParam(testmode, intval($this->testmode));
$socket = @fsockopen(one2xs.com, 80, $errno, $errstr, 10);
if(!is_resource($socket))
{
echo Kan niet met de one2xs.com server verbinden. Neem contact op met de beheerder van deze website.;
}
$url = /api/bel/handle.php?.substr($this->getStringtosend(), 0, -1);
$this->url = www.one2xs.com.$url;
$send = "GET ".$url." HTTP/1.0rn".
"Host: www.one2xs.comrn".
"Connection: Closernrn";
fputs($socket, $send);
$data = ;
while($output = fread($socket, 1024))
{
$data .= $output;
}
$this->data = $data;
$raw = explode("rnrn", $data);
$this->headers = $raw[0];
if(!isset($raw[1]))
echo Onverwachte output;
else
$this->body = $raw[1];
fclose($socket);
$this->parseMessages();
if(isset($this->messages[error]))
{
echo Er is een fout opgetreden: .$this->messages[error];
return FALSE;
}
return TRUE;
}
public function getUrl()
{
return $this->url;
}
private function parseMessages()
{
$messages = explode("rn", $this->body);
if(count($messages) > 0)
{
foreach($messages as $message)
{
$parts = explode(=, $message);
if(count($parts) == 2)
{
$this->messages[$parts[0]] = $parts[1];
}
}
}
}
public function getMessages()
{
return $this->messages;
}
public function getBody()
{
return $this->body;
}
}
?>