Forum Moderators: coopster
i have now got past one problem and i am now faced with another after adapting the code posted in the above link.
This time my error is "Wrong Number of Lines, or Line missingLINE ERROR".
I have contacted the supplier and they said the xml I sent to them in an email was correct, but as they dont know php they couldnt help me with why I was getting this problem.
here is the full code i am using:
$request = '<?xml version="1.0" standalone="yes"?>
<order>
<header>
<securitycode>testcode</securitycode>
<orderref>TEST IGNORE</orderref>
<orderdatetime>'.date("m/d/Y H:i:s").'</orderdatetime>
<daterequired>'.date("m/d/Y").'</daterequired>
<deliveryaddress>
<deliverycontact>MR Smith</deliverycontact>
<deliveryname>Smith Shops</deliveryname>
<addressline1>addressline1</addressline1>
<addressline2>addressline2</addressline2>
<addressline3>addressline3</addressline3>
<addressline4>addressline4</addressline4>
<postcode>AA1 1AA</postcode>
</deliveryaddress>
</header>
<line>
<lineno>1</lineno>
<tlcpartno>PF7SS320</tlcpartno>
<quantity>10</quantity>
</line>
</order>';
// Create Headers
$header[] = "Host: www.supplierswebsite.com";
$header[] = "Content-type: text/xml";
$header[] = "Content-length: ".strlen($request) . "\r\n";
$header[] = $request;
// Send using CURL
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, "https://www.supplierswebsite.com/getxml.asp?action=ORDER&account=testing"); // URL to post
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); // return into a variable
curl_setopt( $ch, CURLOPT_HTTPHEADER, $header ); // headers from above
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$result);
$result = curl_exec( $ch ); // runs the post
curl_close($ch);
echo $result; // echo reply response
as mentioned above, the $result returns - "Wrong Number of Lines, or Line missingLINE ERROR"
any ideas where i am going wrong?
thanks in advance
i have since been on the phone again to the tech guy and after a while we figured out it was one of the names was different to what he had sent me and what he had set up on there server.
overall though it was good as we came across some problems with some of the status messages that was being returned.
Thanks