March 27th, 2013, 06:20 PM
PHP Scrape From HTML/Header
Hello all, newbie to the forum here would appreciate some help.
I'm developing an application where I intend to scrape the HTML post after a form submission. The purpose of the scrape is to capture field values from the form submission (like confirmation number or successful text) and redirect back to my site.
1. User goes to third party site (via my site)
2. User submits form (payment for example)
3. I scrape the response from that POST
4. I redirect to my page with the captured required form data (successful purchase for example).
My question is, is this a valid flow for PHP processing and if so, can I contain this scrape class in a header above the page? I am open to any flow changes or suggestions too.
Thank you all for the help, much appreciated!
March 27th, 2013, 07:22 PM
Doing that is completely unnecessary
all you need to do is make a hidden field for the form in HTML, assign it a unique name and give it the value of the confirmation number also make sure to give unique names to those other fields in the form last but not least make sure you gave the form a unique name
Then in the php script do a check by using if(isset($_POST['form_name'])) and then if that condition is met use $_POST['field_name'] to get the data that was submitted then use if's to process the submitted info
also if you intend on doing this all on 1 page, you can have the form set in the else condition for the form submission check
Last edited by jack13580; March 27th, 2013 at 09:29 PM.
March 27th, 2013, 09:12 PM
Thank you for the quick reply Jack! I will follow the steps and update accordingly. It does make sense now.
Originally Posted by jack13580
March 27th, 2013, 09:13 PM
And by the way, if the form is on another site and the form submits to that other site, you can't know about anything being submitted. Why? Because it's on another site.
March 27th, 2013, 09:39 PM
That's wrong because the user is the one entering in the info for the form and if you view the source you can see all the hidden fields for the form
also you can use firebug to catch any data that gets submitted and view it using the developer console
Last edited by jack13580; March 27th, 2013 at 09:41 PM.
March 27th, 2013, 10:09 PM
By "you" he meant ramsen's site, not "you" as in the person visiting the site.
Comments on this post