944,162 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 4344
  • PHP RSS
Mar 2nd, 2006
0

How to grab a page?

Expand Post »
Hi Everyone,

I am having two sites.

I am presently using a registration form at my new site to register a user at my second site(old one). For this i am passing all the required form values to old site at the submit of form via post method (like username,password etc.).

I want to catch the page of the second site(old one) (where i am registering the new user) after the form is submited and checking of database (like the redirected page which shows "your account is created" or "this account already exists").

Please if any one could help me in catching the html page which is redirected after the submission of data as i dont want to redirect the user from my new site to the old site after the submission of the data.

Thanks in advance.

Varun
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
varuna1 is offline Offline
3 posts
since Mar 2006
Mar 3rd, 2006
0

Re: How to grab a page?

Your best bet would be to use an XMLHTTP request to POST the data to the old site, and capture the response from that site. For this you would need to send an additional value through the POST to identify the submission as a remote submission. You will need to modify the POST handling script on the old site so that any submissions with the remote submission identifier will not redirect the user to another page, but return a response to the form page.

A quick Google for XMLHTTP should give you several good introductory scripts and tutorials to get you going.
Reputation Points: 16
Solved Threads: 7
Junior Poster
Lafinboy is offline Offline
166 posts
since Jul 2004
Mar 3rd, 2006
0

Re: How to grab a page?

Hi,

Thanks for replying.
But presently i dont want to make any changes in my old site(as old site is also functional). so i want if without making any changes to the old site and its functionality (if possible); some how using sockets or something else which i could use on new site form only to catch the response from old site's page redirection page.
If you can suggest me something for this.
Thanks.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
varuna1 is offline Offline
3 posts
since Mar 2006
Mar 3rd, 2006
0

Re: How to grab a page?

The page the form is submitted to is on the old site correct? At any rate you need to edit the page the form is submitted to and add a header using PHP


[PHP]<?php
// make sure to verify your data

header("Location: http://oldsites_name/oldsite_page");

?>[/PHP]

Make sure when using the header function that you don't send any output to the browser before the header call, for example this won't work:

[PHP]<html>
<?php
// make sure to verify your data

header("Location: http://oldsites_name/oldsite_page");

?>[/PHP]
Reputation Points: 17
Solved Threads: 14
Posting Whiz
DanceInstructor is offline Offline
355 posts
since Feb 2005
Mar 4th, 2006
0

Re: How to grab a page?

Varuna1, I think my screen-scraping PHP class (class_http.php) may help you. Check it out at:
http://www.troywolf.com/articles/php/class_http/

At first glance, you may think "screen-scraping" is not what you need, but if you look closely at my class, you'll see it supports POSTING form variables to the remote page. With my PHP class, you can post your form variables to your old page and get back the result--ALL SERVER-SIDE in your PHP. You can then decide what you want to send back to your user's browser.

By the way, Microsoft's XMLHTTP COM object is something you'd use in ASP/VBScript--not PHP. I suppose you could use a client-side XMLHTTP Javascript call to create a solution. ("AJAX" uses client-side XMLHTTP.)
Reputation Points: 36
Solved Threads: 6
Posting Whiz
Troy is offline Offline
354 posts
since Jun 2005
Mar 4th, 2006
0

Re: How to grab a page?

Hi Troy
Thanks for your suggestion. Its really very helpful in my work.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
varuna1 is offline Offline
3 posts
since Mar 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: which is faster? looking in a dir or MySQL
Next Thread in PHP Forum Timeline: :?: how do I start? :?:





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC