Passing variables without post or get?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dimxasnewfrozen
Forum Commoner
Posts: 84
Joined: Fri Oct 30, 2009 1:21 pm

Passing variables without post or get?

Post by dimxasnewfrozen »

Not sure how to do this but,

I have a form that does some validation from the POST variables

I need to send the POST variable to another page on a different server. Currently I am doing it this way:

$url = "http:servernumber2?id=$posted_variable
$myresult = file_get_contents($url);
echo $myresult;

Is there a way to pass the variable to the other file without sending it through the URL?
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: Passing variables without post or get?

Post by josh »

User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Passing variables without post or get?

Post by AbraCadaver »

To pass variables to a different server?

You can look at http_post_data(), something here: http://us3.php.net/manual/en/book.http.php or possibly cURL.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: Passing variables without post or get?

Post by josh »

How about a web service over https?

Example

Machine 1 sends XML of data ( as POST data over an https request) to Machine 2
Machine 2 saves parameters and assigns a session ID, passes session ID to machine 1
Machine 1 redirects user to Machine 2 using only the session ID in the URL.

http_post_data may not work for him because he wants the user to end on Machine 2, am I right? Well it would work but you need the last 2 steps.

By the way SESSION would work too and would be my preference. You would just have to customize PHP to work under that set up (by overriding save handlers and such)
Post Reply