|
| Accessing HTTP POST variables |
| Iniciado por guest, jun., 13 2008 9:23 AM - 5 respostas |
| |
| | | |
|
| |
| Publicado em junho, 13 2008 - 9:23 AM |
Hi all, While I'm waiting for PC Soft to respond, perahps somewhere here can tell me how to access HTTP POST data in a WebDev page? i.e. the equivilent of PHP's $_POST["xxx"] array. SysEnvironment() will reveal the HTTP GET query string, but not POST data. Thanks, Roger |
| |
| |
| | | |
|
| | |
| |
| Publicado em junho, 13 2008 - 8:03 PM |
Hi Roger, Variable's coming in through a post should be accessible via the control name, so for example lets say I had a hidden field name pageID that had data I needed.. in webdev I'd simply reference it directly; trace(pageID) variables passed via the command line or parameter string would be referenced via; myString = PageParameter("myString") or myString = PageParameter("P1") HTH Cheers! Ken |
| |
| |
| | | |
|
| | |
| |
| Publicado em junho, 14 2008 - 3:54 PM |
Hi Ken, It seems PageParameter() can be also be used on POST variables, and should serve my purpose in this instance, thanks. A separate variable (array) storing only HTTP POST data, and another storing HTTP GET query string data (a la PHP etc) would make a lot more sense however. With PageParamater() I need to firstly check QUERY_STRING in SysEnvironment() to make sure it's not a HTTP GET query string, before I can assume the data has come via POST. Isn't WebDev supposed to make our life more simple? And how to quickly show all HTTP POST variables that have been sent to a page? It's print_r($_POST) in PHP. Can it even be done in WebDev? Arrrrrgh! Cheers... Roger PS. FWIW, I'm implementing PayPal's Instant Payment Notification for a web site. PayPal does an HTTP POST to a web page to verify the payment details. I'm beginning to think I may as well just use a PHP script, and use the HyperFile ODBC driver to store the results in my database. |
| |
| |
| | | |
|
| | |
| |
| Publicado em junho, 15 2008 - 2:53 AM |
Hi Roger, Similarly, you could also check the value of "REQUEST_METHOD" to determine whether its a POST or GET and act accordingly. Cheers! Ken |
| |
| |
| | | |
|
| | |
| |
| Publicado em junho, 15 2008 - 2:54 AM |
Hi Ken, Yes, I must have missed REQUEST_METHOD. Certainly it's a much better idea for checking the type of request, thanks. In any event, for the time being I've implemented PayPal IPN using PHP. PayPal requires that every variable that gets POSTed to your page, is POSTed back to PayPal (to verify where the request came from). Since there are a large number of variables coming from PayPal, it's so much easier to simply loop through a POST array to create the data to POST back to PayPal, as opposed to manually creating the data from each individual variable. Furthermore, by looping through a POST array, I am automatically future-proofing this part of the process. If PayPal changes or adds a variable, I am still covered. Cheers... Roger |
| |
| |
| | | |
|
| | |
| |
| Publicado em junho, 15 2008 - 2:54 AM |
Agreed, that will be much easier. If I come up with a solution I'll post it to this thread. Cheers! Ken |
| |
| |
| | | |
|
| | | | |
| | |
|