XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).
Moderator: General Moderators
daven
Forum Contributor
Posts: 332 Joined: Tue Dec 17, 2002 1:29 pm
Location: Gaithersburg, MD
Contact:
Post
by daven » Fri Mar 07, 2003 10:33 am
I do not have PHP's cURL functions installed, so I am doing a command-line use of cURL. Everything works fine, but I never get a proper submission.
my command (all the parameters are legal and correct)
Code: Select all
curl --url https://xml.test.surepay.com --sslv3 --show-error --verbose --form xml= < /path/to/the/xml/document.xml
my request xml document:
Code: Select all
<!DOCTYPE pp.request PUBLIC "-//IMALL//DTD PUREPAYMENTS 1.0//EN" "http://www.purepayments.com/dtd/purepayments.dtd">
<pp.request merchant="1001" password="password">
<pp.auth ordernumber="11111" shippingcost="1.00USD" taxamount="0.00USD" verbalauthdate="20030307111516000" >
<pp.creditcard number="4012000033330026" expiration="12/05" cvv2="0" cvv2status="0">
<pp.address type="billing" fullname="Daven Williams" address1="1872 Pratt Dr" city="Blacksburg" state="VA" zip="24060" country="US" eveningphone="5409533343" email="daven@exegetics.com" /></pp.creditcard>
<pp.address type="shipping" fullname="Daven Williams" address1="1872 Pratt Dr" city="Blacksburg" state="VA" zip="24060" country="US" eveningphone="5409533343" email="daven@exegetics.com" />
<pp.lineitem sku="223aa" description="MyItem" quantity="2" taxrate="0" unitprice="5.00USD"></pp.lineitem></pp.auth></pp.request>
I send it off correctly and get the following response:
Code: Select all
<!DOCTYPE pp.response PUBLIC "-//IMALL//DTD PUREPAYMENTS 1.0//EN" "http://www.purepayments.com/dtd/purepayments.dtd">
<pp.response>
XML syntax error: Missing pp.request merchant
</pp.response>
As far as I can tell, I have the <pp.request merchant> tag in my request document. Any help would be greatly appreciated
Stoker
Forum Regular
Posts: 782 Joined: Thu Jan 23, 2003 9:45 pm
Location: SWNY
Contact:
Post
by Stoker » Fri Mar 07, 2003 2:06 pm
Surepay is a pain, their SDK is full of errors and their own samples don't even work..
My sugesstion would be to post to your own script somewhere and just return the data or perhaps a print_r of it, just to make sure that you are infact posting it all..
Stoker
Forum Regular
Posts: 782 Joined: Thu Jan 23, 2003 9:45 pm
Location: SWNY
Contact:
Post
by Stoker » Fri Mar 07, 2003 2:15 pm
actually, perhaps a space after xml= may be the prob....
and another thing, if you are doing CC transactions this will be very insecure in any shared hosting environment as you are writing the number in cleartext to a file, that is a big big big nonono!
I would have put the xml=<!DOCTYPE ... inside the file and tried something like
from PHP, something like
$postdata = escapeshellarg('xml='.$xmldata);
$result = shell_exec('/path/to/curl --url
https://xml.test.surepay.com --sslv3 --show-error --verbose --data '.$postdata);
daven
Forum Contributor
Posts: 332 Joined: Tue Dec 17, 2002 1:29 pm
Location: Gaithersburg, MD
Contact:
Post
by daven » Fri Mar 07, 2003 2:36 pm
Thank you so much.
I was using system instead of shell_exec for some unknown reason, and I forgot to use escapeshellarg. The file input was just for testing purposes (so I did not have to generate data each time), not actual data.
*kicks self for being an idiot*