Cable Forum

Cable Forum (https://www.cableforum.uk/board/index.php)
-   General IT Discussion (https://www.cableforum.uk/board/forumdisplay.php?f=19)
-   -   Php stuff (https://www.cableforum.uk/board/showthread.php?t=26824)

Mr_love_monkey 06-04-2005 09:48

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).

punky 06-04-2005 10:01

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

Mr_love_monkey 06-04-2005 10:04

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... :)

punky 06-04-2005 10:07

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.

Richard M 06-04-2005 10:47

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");
?>


philip.j.fry 06-04-2005 10:48

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 :)

Mr_love_monkey 06-04-2005 11:37

Re: Php stuff
 
Quote:

Originally Posted by Richard M
PHP Code:

<?php include_once("http://www.example.com/somefile.php?variable=attribute");
?>


Excellent!

Richard M 06-04-2005 12:31

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");
?>


punky 06-04-2005 12:36

Re: Php stuff
 
Oh yeah, the includes... How the hell did I miss that...?


All times are GMT. The time now is 17:35.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
All Posts and Content are © Cable Forum