06-04-2005, 09:48
|
#1
|
|
Inactive
Join Date: Jun 2003
Location: London way
Age: 50
Services: Sarcasm
Posts: 8,376
|
Php stuff
ok, what I'm looking to do is from one website, during a process, make a call to another website address, passing along x amount of information, but without physically redirecting from the current page.
Obviously the recieving page can just pull the data out of the url, but how does the calling page make the request, without doing a literal forward?
(if any of that makes sense).
|
|
|
06-04-2005, 10:01
|
#2
|
|
Inactive
Join Date: Jun 2003
Age: 45
Posts: 14,750
|
Re: Php stuff
Quote:
|
Originally Posted by Mr_love_monkey
ok, what I'm looking to do is from one website, during a process, make a call to another website address, passing along x amount of information, but without physically redirecting from the current page.
Obviously the recieving page can just pull the data out of the url, but how does the calling page make the request, without doing a literal forward?
(if any of that makes sense).
|
Well, you can do a HTTP POST.
You'd set up a form, with a POST action, and a submit button. You would leave your inital page, so you'd have to redirect back.
For example you would do something like
initalpage.htm
Code:
<form action="secondpage.php" method="post">
<input type="text" anme="name" size="20">
<input type="submit" value="Submit Form">
</form>
and in secondpage.htm
PHP Code:
echo $_POST['name'];
You could use javascript and open a link in another window, but popup blockers will probably block it:
Code:
window.open('secondpage.php?name=punky','newwindow');
And you would GET instead of POST to get the name like:
PHP Code:
echo $_GET['name'];
HTH
|
|
|
06-04-2005, 10:04
|
#3
|
|
Inactive
Join Date: Jun 2003
Location: London way
Age: 50
Services: Sarcasm
Posts: 8,376
|
Re: Php stuff
No, it needs to be invisible - I need to make the call without disrupting the flow from the current page.
I could do it easily in java... grumble grumble...
|
|
|
06-04-2005, 10:07
|
#4
|
|
Inactive
Join Date: Jun 2003
Age: 45
Posts: 14,750
|
Re: Php stuff
Quote:
|
Originally Posted by Mr_love_monkey
No, it needs to be invisible - I need to make the call without disrupting the flow from the current page.
I could do it easily in java... grumble grumble... 
|
If you are feeling brave, you can use PHP sockets.
|
|
|
06-04-2005, 10:47
|
#5
|
|
Inactive
Join Date: Jun 2003
Location: Los Angeles, CA
Age: 47
Posts: 6,343
|
Re: Php stuff
Quote:
|
Originally Posted by Mr_love_monkey
No, it needs to be invisible - I need to make the call without disrupting the flow from the current page.
I could do it easily in java... grumble grumble... 
|
PHP Code:
<?php include_once("http://www.example.com/somefile.php?variable=attribute");
?>
|
|
|
06-04-2005, 10:48
|
#6
|
|
Inactive
Join Date: Jul 2003
Posts: 1,395
|
Re: Php stuff
Quote:
|
Originally Posted by Mr_love_monkey
I could do it easily in java... grumble grumble... 
|
As far as I can see, you can do it in a similar way as you can in Java, you just open a remote file and read it in, then do what you want with the data.
http://www.scit.wlv.ac.uk/appdocs/ph...ote-files.html
Quote:
|
Originally Posted by punky
If you are feeling brave, you can use PHP sockets.
|
Bit of an overkill for Mr LM but just what I was looking for
|
|
|
06-04-2005, 11:37
|
#7
|
|
Inactive
Join Date: Jun 2003
Location: London way
Age: 50
Services: Sarcasm
Posts: 8,376
|
Re: Php stuff
Quote:
|
Originally Posted by Richard M
PHP Code:
<?php include_once("http://www.example.com/somefile.php?variable=attribute");
?>
|
Excellent!
|
|
|
06-04-2005, 12:31
|
#8
|
|
Inactive
Join Date: Jun 2003
Location: Los Angeles, CA
Age: 47
Posts: 6,343
|
Re: Php stuff
Quote:
|
Originally Posted by Mr_love_monkey
Quote:
|
Originally Posted by Richard M
PHP Code:
<?php include_once("http://www.example.com/somefile.php?variable=attribute");
?>
|
Excellent!
|
Remember to leave it in double quotes so the string is evaluated.
This would not work:
PHP Code:
<?php include_once('http://www.example.com/somefile.php?variable=$value'); ?>
But this would:
PHP Code:
<?php include_once("http://www.example.com/somefile.php?variable=$value");
?>
|
|
|
06-04-2005, 12:36
|
#9
|
|
Inactive
Join Date: Jun 2003
Age: 45
Posts: 14,750
|
Re: Php stuff
Oh yeah, the includes... How the hell did I miss that...?
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT. The time now is 15:56.
|