Jump to content

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!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.