tags:

views:

616

answers:

3

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.

A: 

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

Grayside
+1  A: 

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.

Kent Fredric
+1  A: 

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

It could be something like a read file permission problem.

csl