XML-Request
| From: | Paykiosks) | Date: | Fri, 13 Jan 2006 00:46:01 +0000 |
| Subject: | XML-Request | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-228548@lists.php.net to get a copy of this message | ||
Hi, I gotta send an XML request to a server. In the doc it's defined as
follows:
[request]
<xs:request xmlns:xs='urn:pinXpressSchema' version='1.5'
langCode='en'>
<DEALERinfo aspName=‘XXX’
dealerName=''
posName='1234'
posPassword='1234'
userName=''
userPassword='1234' />
<purchasePINs transID='1234567890' ticket='true' ticketWidth='32'
/>
</xs:request>
[/request]
and I tried to realize it that way:
[Code]
<?php
$n = "\n\n";
$aspName="XXX";
$dealerName="paykiosks";
$posName="998745";
$posPasswords="998745";
$userName="";
$userPassword="";
$inputdata = '<xs:request xmlns:xs=\'urn:pinXpressSchema\'
version=\'1.5\' langCode=\'en\'>'.$n.'
<DEALERinfo aspName='.$aspName.'
dealerName='.$dealerName.'
posName='.$posName.'
posPassword='.$posPassword.'
userName='.$userName.'
userPassword='.$userPassword.'/>
<purchasePINs transID=1234567890 ticket=true ticketWidth=32 />
</xs:request>';
$x = curl_init("https://xml.pinsprepaid.com/xml/xmlPinXpress.asp");
curl_setopt($x, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));
curl_setopt($x, CURLOPT_HEADER, 0);
curl_setopt($x, CURLOPT_POST, 1);
curl_setopt($x, CURLOPT_POSTFIELDS, $inputdata);
curl_setopt($x, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($x, CURLOPT_REFERER, "http://localhost/test.php");
curl_setopt($x, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($x);
curl_close($x);
echo $data;
?>
[Code]
but I only got the Answer:
"invalid xml"
Why, what's going wrong? Thank you for your help!