Sending $_POST['field'] via browser window and PHP?
Moderator: General Moderators
Sending $_POST['field'] via browser window and PHP?
Hey there,
I want to be able to open a PHP page in a browser window which then redirects to another website but also sending a $_POST['field'] without the use of a form.
Any ideas on how I can do this? I've seen it done with ASP.
Thanks
Ben
I want to be able to open a PHP page in a browser window which then redirects to another website but also sending a $_POST['field'] without the use of a form.
Any ideas on how I can do this? I've seen it done with ASP.
Thanks
Ben
- protokol
- Forum Contributor
- Posts: 353
- Joined: Fri Jun 21, 2002 7:00 pm
- Location: Cleveland, OH
- Contact:
See this post: viewtopic.php?t=28161
you can use a hidden input variable, and a form with no button
use JS to open a new window and target the results of the post
use JS to open a new window and target the results of the post
Code: Select all
//JS code
window.open('','results','toolbar=0,width=50,height=50');
document.formї0].target = 'results';
document.formї0].submit();I don't think i want to use JS:
viewtopic.php?t=28161
viewtopic.php?t=7063
I don't think they are what I need. I don't want to just send a post value but I also want to redirect them page to the page I am sending the post value too.
The reason why I want this is becuase when they login to their script, it then sends them to my website checking their license key.
If the license is valid, it redirects back to the referring website, sending a POST. Once they get back to their script, the script will set a session() with that POST, enabling them, to use the script.
If its not valid, it will send another POST saying that it's not valid.
I suppose this is the sort of thing I would need but I don't know how to get it working:
Thanks for the help!
viewtopic.php?t=28161
viewtopic.php?t=7063
I don't think they are what I need. I don't want to just send a post value but I also want to redirect them page to the page I am sending the post value too.
The reason why I want this is becuase when they login to their script, it then sends them to my website checking their license key.
If the license is valid, it redirects back to the referring website, sending a POST. Once they get back to their script, the script will set a session() with that POST, enabling them, to use the script.
If its not valid, it will send another POST saying that it's not valid.
I suppose this is the sort of thing I would need but I don't know how to get it working:
Code: Select all
<?php
header("POST /index.html HTTP/1.1");
header("Host: http://www.algirdas.com");
header("User-Agent: Mozilla/4.0");
header("Content-Length: 23");
header("Content-Type: application/x-www-form-urlencoded");
print("merchant_account_id=223");
?>Here is another idea for you...
You could use curl or one of the other file opening functions, that allow you to open urls from within a php, thus no need for you to redirect them, which would also mean that you could do away with the need to post.
You could use curl or one of the other file opening functions, that allow you to open urls from within a php, thus no need for you to redirect them, which would also mean that you could do away with the need to post.
Code: Select all
<?
if (!eregi('License Valid',file_get_contents("http://www.algirdas.com/?merchant_account_id=223"))) {
# License is invalid... do something
Header("Location: Invalid.html");
}
?>I gave you code a whirl anyway and am getting this error:
Parse error: parse error, unexpected $ in c:\program files\easyphp\www\created\post\check.php on line 7
Heres the code:
Wots wrong with that?
Parse error: parse error, unexpected $ in c:\program files\easyphp\www\created\post\check.php on line 7
Heres the code:
Code: Select all
<?
if (!eregi('License Valid',file_get_contents("test.php?valid=no"))) {
echo "valid";
} else {
echo "not valid";
?>
?>-
Bennettman
- Forum Contributor
- Posts: 130
- Joined: Sat Jun 15, 2002 3:58 pm