0

I'm using the WorldPay payment gateway on a website I'm working on. It handles all the credit card authorisation, and then calls a PHP file on my server with information about the transaction. It grabs the output from my script and displays it in the WorldPay chrome.

I don't know the inner workings, but I imagine that they'd be using something similar to cURL to post the transaction details to my script and to then retrieve the output.

My script writes the necessary information into an XML file, sends an email and then thanks the customer for shopping with us.

My problem is that when I test my file by calling it directly (by turning off the security checks and visiting http://example.com/mysite/myscript.php in my browser), everything works as planned, however when I go through the payment system (so I assumed my script is being called via cURL), it fails on this line:

$xml = simplexml_load_file('./info.xml');

Any ideas??

Clarification: that line returns false, which breaks the following lines.

3 Answers 3

1

This might be a stretch, but check one of php's number one confusions with relative path resolution.

'./' 

is relative to wherever Entrypoint is, not the script, which is why I use

dirname(__FILE__).'/' 

everywhere instead.

1

Check your HTTP error logs -- make sure they're turned on.

It could be something like a read file permission problem.

0

Are you sure the path to info.xml is correct? That gets me sometimes when I am including a file from a subdirectory.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.