Vytas Posted September 27, 2009 Share Posted September 27, 2009 Hello, I have been trying to make autopay script for Liberty Reserve but I'm always getting "100Invalid XML structure", My code: <?php include("settings.php"); function Gen_id() { return time().rand(0,9999); } function Gen_token_hash($securityword) { date_default_timezone_set('UTC'); $token = $securityword.":".gmdate("Ymd:H"); $token_hash = strtoupper(hash('sha256', $token)); return $token_hash; } function xmlBody($APIname, $securityword, $payeracct, $payeeacct, $amount, $memo, $isprivate) { return trim( "<TransferRequest id=".Gen_id().">". "<Auth>". "<ApiName>".$APIname."</ApiName>". "<Token>".Gen_token_hash($securityword)."</Token>". "</Auth>". "<Transfer>". "<TransferType>transfer</TransferType>". "<Payer>".$payeracct."</Payer>". "<Payee>".$payeeacct."</Payee>". "<CurrencyId>LRUSD</CurrencyId>". "<Amount>".$amount."</Amount>". "<Memo>".$memo."</Memo>". "<Anonymous>".$isprivate."</Anonymous>". "</Transfer></TransferRequest>"); } $data = urlencode(xmlBody($APIname,$securityword,$payeracct,$payeeacct,$amount,$memo,$isprivate)); $URL = "https://api.libertyreserve.com/xml/transfer.aspx?req=".$data; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $URL); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $ex = curl_exec($ch); if(!$ex) { echo "Error: ".curl_error($ch); } else { echo $ex; } curl_close($ch); ?> There's a some info on how to do this, but i just can't get it to work... Link to comment https://forums.phpfreaks.com/topic/175687-lr-autopay-script/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.