| | |
How to grab a page?
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Mar 2006
Posts: 3
Reputation:
Solved Threads: 0
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
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
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.
A quick Google for XMLHTTP should give you several good introductory scripts and tutorials to get you going.
If I've been a help please confirm by clicking the Add to Lafinboy's Reputation link in the header of this reply.
Lafinboy Productions
:: Website Design :: Website Development ::
Lafinboy Productions
:: Website Design :: Website Development ::
•
•
Join Date: Mar 2006
Posts: 3
Reputation:
Solved Threads: 0
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.
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.
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]
[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]
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.)
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.)
![]() |
Similar Threads
- Passing data from forms from one page to another (JavaScript / DHTML / AJAX)
- Grabbing and reading text file (C)
- Grab info from vB and put into HTML page (Social Media and Online Communities)
- urgent-how to pass multiple values to the parent form (ASP)
Other Threads in the PHP Forum
- Previous Thread: which is faster? looking in a dir or MySQL
- Next Thread: :?: how do I start? :?:
Views: 3206 | Replies: 5
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array autosuggest beginner binary broken cakephp checkbox class cms code cron curl database date directory display download dynamic echo email emptydisplayvalue error explodefunction file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla jquery keywords limit link login loop mail menu methods mlm mod_rewrite multiple mysql oop parse paypal pdf php problem query radio random recursion regex remote script search searchbox select server sessions sms soap source space speed sql structure syntax system table tutorial update updates upload url validation validator variable video web xml youtube





