<?php
function getMollie($pid,$amount,$country){
$file = file("http://www.mollie.nl/xml/micropayment/?a=fetch&partnerid=".$pid."&amount=".$amount."&country=".$country."");
for($i=0; $i < count($file); $i++){
$row = trim($file[$i]);
$woord="servicenumber";
$l=strlen($woord)+2;
if(substr($row,0,$l)=="<".$woord.">"){
$return[$woord]=strip_tags($row);
}
$woord="paycode";
$l=strlen($woord)+2;
if(substr($row,0,$l)=="<".$woord.">"){
$return[$woord]=strip_tags($row);
}
$woord="amount";
$l=strlen($woord)+2;
if(substr($row,0,$l)=="<".$woord.">"){
$return[$woord]=strip_tags($row);
}
$woord="duration";
$l=strlen($woord)+2;
if(substr($row,0,$l)=="<".$woord.">"){
$return[$woord]=strip_tags($row);
}
$woord="mode";
$l=strlen($woord)+2;
if(substr($row,0,$l)=="<".$woord.">"){
$return[$woord]=strip_tags($row);
}
$woord="costperminute";
$l=strlen($woord)+2;
if(substr($row,0,$l)=="<".$woord.">"){
$return[$woord]=strip_tags($row);
}
$woord="currency";
$l=strlen($woord)+2;
if(substr($row,0,$l)=="<".$woord.">"){
$return[$woord]=strip_tags($row);
}
$woord="costpercall";
$l=strlen($woord)+2;
if(substr($row,0,$l)=="<".$woord.">"){
$return[$woord]=strip_tags($row);
}
}
return $return;
}
function checkMollie($code,$servicenumber){
$file = file("http://www.mollie.nl/xml/micropayment/?a=check&servicenumber=".$servicenumber."&paycode=".$code."");
for($i=0; $i < count($file); $i++){
$row = trim($file[$i]);
$woord="servicenumber";
$l=strlen($woord)+2;
if(substr($row,0,$l)=="<".$woord.">"){
$return[$woord]=strip_tags($row);
}
$woord="costpercall";
$l=strlen($woord)+2;
if(substr($row,0,$l)=="<".$woord.">"){
$return[$woord]=strip_tags($row);
}
$woord="payed";
$l=strlen($woord)+2;
if(substr($row,0,$l)=="<".$woord.">"){
$return[$woord]=strip_tags($row);
}
$woord="paying";
$l=strlen($woord)+2;
if(substr($row,0,$l)=="<".$woord.">"){
$return[$woord]=strip_tags($row);
}
$woord="mode";
$l=strlen($woord)+2;
if(substr($row,0,$l)=="<".$woord.">"){
$return[$woord]=strip_tags($row);
}
$woord="durationdone";
$l=strlen($woord)+2;
if(substr($row,0,$l)=="<".$woord.">"){
$return[$woord]=strip_tags($row);
}
$woord="durationleft";
$l=strlen($woord)+2;
if(substr($row,0,$l)=="<".$woord.">"){
$return[$woord]=strip_tags($row);
}
$woord="amount";
$l=strlen($woord)+2;
if(substr($row,0,$l)=="<".$woord.">"){
$return[$woord]=strip_tags($row);
}
$woord="paystatus";
$l=strlen($woord)+2;
if(substr($row,0,$l)=="<".$woord.">"){
$return[$woord]=strip_tags($row);
}
}
}
// eerst id, dan kosten en dan de landcode.
$data = getMollie('1','1.75','31');
echo "<pre>";
print_r($data);
echo "</pre>";
//na het gebruiken moet je dit posten, dus op de volgende pagina:
$data = checkMollie($code,$servicenumber);
echo "<pre>";
print_r($data);
echo "</pre>";
?>