#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    2
    Rep Power
    0

    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.

    Flow is:
    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!
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2012
    Posts
    194
    Rep Power
    76
    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 08:29 PM.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    2
    Rep Power
    0
    Thank you for the quick reply Jack! I will follow the steps and update accordingly. It does make sense now.



    Originally Posted by jack13580
    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 ment 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
  6. #4
  7. Come play with me!
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    13,754
    Rep Power
    9397
    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.
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2012
    Posts
    194
    Rep Power
    76
    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.
    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 08:41 PM.
  10. #6
  11. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,301
    Rep Power
    7170
    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
    By "you" he meant ramsen's site, not "you" as in the person visiting the site.

    Comments on this post

    • jack13580 agrees
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around

IMN logo majestic logo threadwatch logo seochat tools logo