Computing.Net > Forums > Web Development > PHP: sending data via GET method

PHP: sending data via GET method

Reply to Message Icon

Original Message
Name: fem
Date: October 11, 2004 at 07:50:12 Pacific
Subject: PHP: sending data via GET method
OS: NA
CPU/Ram: NA
Comment:

I am trying to develop a script that processes data arriving via GET statement into my PHP script and posts reponse to another URL as a GET statement containing a list of variables. How can I generate this GET statement from PHP and send it to predefined URL?
Thanking you in advance ... Oleg


Report Offensive Message For Removal

Response Number 1
Name: Khalid
Date: October 12, 2004 at 10:06:20 Pacific
Subject: PHP: sending data via GET method
Reply: (edit)

Normally PHP questions in this forum are answered quickly. The reason your question staid unanswered a little longer is not certain to me, but may have something to do with the fact that your question wasnt real clear...
You can use this function to open connections to a (http)server.

Is this what you were looking for?


Report Offensive Follow Up For Removal

Response Number 2
Name: Laler
Date: October 12, 2004 at 12:55:45 Pacific
Subject: PHP: sending data via GET method
Reply: (edit)

:D

I see it as if he's just want to retrieve some variables from URL (GET), while also sending some other variables (also using GET) :D

ok, let's make sure :D


to Fem:

have you looked at Khalid's link? is that what you mean?

if not, please answer this:

1. do you know how to receive the "data arriving via GET statement" in your PHP script?

2. do you just want to know how to send the variables to "predefined URL" by using GET?

for #1, I did try to look for some basic form tutorial, but I can't find anything specifically for your case... so here's a little script, you might want to search the functions on google to find what they're for...

<?php

// assuming you call this script as:
// http://scrip_location/?name=Mike&born=2000

// check the variables
if ((isset ($_GET['Mike'])) and (isset ($_GET['born']))){

// simple process
    $theName = $_GET['name'];
    $theAge = 2004 - $_GET['born'];

// print the result on screen
    echo 'Hello '.$theName.', you\'re '.$theAge.' years old...';

// send to to predefined URL (php script?)
    header ("Location: http://predefined_url_here/?thename=".$theName."&stamp=".time());

    exit();


}

?>

is that what you mean?

^o^
are you in Asia? do you watch Animax Asia? Please Vote


Report Offensive Follow Up For Removal

Response Number 3
Name: Laler
Date: October 12, 2004 at 12:58:16 Pacific
Subject: PHP: sending data via GET method
Reply: (edit)

this:

if ((isset ($_GET['Mike'])) and (isset ($_GET['born'])))

should be:

if ((isset ($_GET['name'])) and (isset ($_GET['born'])));

^o^
are you in Asia? do you watch Animax Asia? Please Vote


Report Offensive Follow Up For Removal

Response Number 4
Name: fem
Date: October 28, 2004 at 03:13:05 Pacific
Subject: PHP: sending data via GET method
Reply: (edit)

Khalid, Laler,

Thanks a lot for your postings and apologies for not being clear in my question.

The objective of the script is:
1. Receive variables from remote server via GET method
2. Process variables based on internal application logic and generate response -- another set of variables
3. Send response variables to remote server
4. Capture unique integer sent by the remote server as an acknowledgement of receiving my submission

Solution I've used:
1. Submitted variables were processed by simply adding $ to the names of the variables in the get string
2. Processing was simple use of logic, loops and MYSQL queries.
3. and 4. I have combined into one step by using function $responseid=file_get_contents(http://serverurl?$my_variables) ... see posting http://www.computing.net/webdevel/wwwboard/forum/977.html for more info.

Works extremely well.

Thanks again for your help,
Oleg


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: PHP: sending data via GET method

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software