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

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

PHP: sending data via GET method

Reply to Message Icon

Name: fem
Date: October 11, 2004 at 07:50:12 Pacific
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



Sponsored Link
Ads by Google

Response Number 1
Name: Khalid
Date: October 12, 2004 at 10:06:20 Pacific
Reply:

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?


0

Response Number 2
Name: Laler
Date: October 12, 2004 at 12:55:45 Pacific
Reply:

: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


0

Response Number 3
Name: Laler
Date: October 12, 2004 at 12:58:16 Pacific
Reply:

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


0

Response Number 4
Name: fem
Date: October 28, 2004 at 03:13:05 Pacific
Reply:

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


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Web Development Forum Home


Sponsored links

Ads by Google


Results for: PHP: sending data via GET method

Get Method with javascript array www.computing.net/answers/webdevel/get-method-with-javascript-array-/2362.html

Submitting data via the web … www.computing.net/answers/webdevel/submitting-data-via-the-web-/526.html

PHP: HTML reponse to variable www.computing.net/answers/webdevel/php-html-reponse-to-variable/977.html