par
VeenZ » 27 juin 2015, 16:13
Bonjour,
J'essaie actuellement de récupérer des informations de la plateforme de micropaiement monelib via leur API mais je rencontre énormément de difficulté
#!/usr/local/php5/bin/php
// La ligne ci‐dessus doit être modifiée selon la configuration de votre système
<?php
function sendXML($xml,$url="") {
$turl=parse_url($url);
if (!isset($turl['path']))
$turl['path']='/';
$curl = curl_init();
curl_setopt($curl,CURLOPT_TIMEOUT,10);
curl_setopt($curl,CURLOPT_POST,1);
curl_setopt($curl,CURLOPT_SSL_VERIFYPEER,false);
curl_setopt($curl,CURLOPT_USERAGENT,"TestMonelib");
curl_setopt($curl,CURLOPT_URL,$turl['scheme'].'://'.$turl['host'].$turl['path']);
curl_setopt($curl,CURLOPT_POSTFIELDS,'ext_xml='.urlencode($xml));
ob_start();
if (curl_exec($curl)!==true)
return false;
$output = ob_get_contents();
ob_end_clean();
curl_close($curl);
return $output;
}
if ($argv[1]=='*') {
$t_files=array();
if ($handle = opendir('.')) {
while (false !== ($file = readdir($handle))) {
if (eregi("^xml",$file)) {
$t_files[]=$file;
}
}
closedir($handle);
}
sort($t_files);
} else {
$t_files=array($argv[1]);
}
foreach($t_files as $filename) {
echo ("Envoi de \"$filename\"\n");
$toSend=file_get_contents($filename);
$rx=sendXML($toSend,'http://gw.monelib.com/index.php');
echo ("Réponse passerelle:\n$rx\n‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐\n");
}
Pouvez-vous me dire comment faire pour récupérer les informations , Merci !
Bonjour,
J'essaie actuellement de récupérer des informations de la plateforme de micropaiement monelib via leur API mais je rencontre énormément de difficulté
[php]#!/usr/local/php5/bin/php
// La ligne ci‐dessus doit être modifiée selon la configuration de votre système
<?php
function sendXML($xml,$url="") {
$turl=parse_url($url);
if (!isset($turl['path']))
$turl['path']='/';
$curl = curl_init();
curl_setopt($curl,CURLOPT_TIMEOUT,10);
curl_setopt($curl,CURLOPT_POST,1);
curl_setopt($curl,CURLOPT_SSL_VERIFYPEER,false);
curl_setopt($curl,CURLOPT_USERAGENT,"TestMonelib");
curl_setopt($curl,CURLOPT_URL,$turl['scheme'].'://'.$turl['host'].$turl['path']);
curl_setopt($curl,CURLOPT_POSTFIELDS,'ext_xml='.urlencode($xml));
ob_start();
if (curl_exec($curl)!==true)
return false;
$output = ob_get_contents();
ob_end_clean();
curl_close($curl);
return $output;
}
if ($argv[1]=='*') {
$t_files=array();
if ($handle = opendir('.')) {
while (false !== ($file = readdir($handle))) {
if (eregi("^xml",$file)) {
$t_files[]=$file;
}
}
closedir($handle);
}
sort($t_files);
} else {
$t_files=array($argv[1]);
}
foreach($t_files as $filename) {
echo ("Envoi de \"$filename\"\n");
$toSend=file_get_contents($filename);
$rx=sendXML($toSend,'http://gw.monelib.com/index.php');
echo ("Réponse passerelle:\n$rx\n‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐\n");
}[/php]
Pouvez-vous me dire comment faire pour récupérer les informations , Merci !