Jump to content

Running a scripted from a different server.


Wstar

Recommended Posts

I was wondering how this is possible with php.  I've looked everywhere for an answer.

 

There is a company that makes memberships and they have a script that creates them.  Its nothing but a long URL.  When the URL is sent, their server replies with a message telling me its done (or if there is a problem).

 

Is there a way php can send the request and get the response?

 

The URL i sent is something like this:

 

http://www.company.com/create.php?action=add_member&user=VALUE&pass=VALUE

 

There are a lot more variables in the URL, but its close.

 

Just wondering if there was something like this out there....

 

$server_reply = function(URL)??

You can do the same thing:

 

server1

$username = isset($_GET['username']) ? $_GET['username'] : 'no username defined';
echo 'Hello, ', $username;

 

server2

print file_get_contents('http://www.server1.com/script.php?username=me');//Hello, me

Thanks so much.  The replies pointed me just where I needed.  I came up with the following, and it works great.

 

$fd = fopen ($url, "r");

$buffer = '';

while(! feof($fd)){

$buffer .= fgets ($fd, 1024);

}

fclose($fd);

 

$url stores the url and $buffer is the response that I get.

 

Thanks again!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.