11 January 2012 at 8:45am
I've created a form that is a gateway to an online payment center that my employer uses to receive donations. The form is supposed to find out how the donor would like to pay, gather the necessary details, write those details to an XML file and then send the XML file to an external URL. So far, the form does the first three steps perfectly. I cannot get the file to send and if it is sending, I cannot get the response from their server to populate my getBody() function.
I've gone through many different steps and most recently I am getting the error:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 8388608 bytes) in C:\xampp\htdocs\pnwu\sapphire\core\control\HTTPRequest.php on line 33
Am I over-thinking this? Is there a simple way to just post this XML file to the URL? Any suggestions would be great. Also if you have successfully sent an XML file from SS, I'd love to know how you accomplished it.
11 January 2012 at 12:02pm
No cURL is native to PHP if you're on a decent host. Looking through SS_HTTPRequest it seems that this class is only for parsing and working with the site URL for SilverStripe and not handling external URL:s. I think cURL might be your best option if that's the kind of thing you need to do.
If you need to send a file try this: [url]http://dtbaker.com.au/random-bits/uploading-a-file-using-curl-in-php.html[/url]
12 January 2012 at 8:17am
I have tried the cURL approach and I don't get any errors but I'm not being redirected to the URL I'm giving it. That is the endgame in this scenario. To be sent with my XML file (or string) to the destination URL.