HTTP GET help

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
Llamabear
Forum Newbie
Posts: 1
Joined: Tue May 06, 2008 1:16 pm

HTTP GET help

Post by Llamabear »

I have to provide a URL to a company that will execute a script on my
webserver and reply to their HTTP GET request. I know my way around
web server admin pretty well, but I have zero experience sending back
data to HTTP GET requests! Would probably be able edit someone elses
script and make it work for us but no luck finding anything. Been
spending lots of time on google looking for a pre-made php solution
and am no closer.. Could some please help out? Its very basic data,
username/password (basically). I need to maintain and update the data
source regularly so it will be pulling the data from mysql. Looking
for php solution so I can edit details easily in the future.

Here is what they gave us...

-------------------------------------
In order to use this you must have a working webserver and the ability
to update content on it. You will need to have a script that will
accept an HTTP GET for each user. We will send the following
variables:

did - This is the number that was dialed

clid - This is the caller id number of the caller

confno - This is the conference number the caller is requesting

In addition you must return data to us in the following format

STATUS=OK

PIN=1234

The pin argument is optional, if specified the user will be prompted
to enter a pin number, if it is not there, no pin will be requested or
used for that conference. If STATUS is not 'OK' then the user will be
informed that the conference number is not valid and asked to reenter
their conference number.
-------------------------------------


...thats all I have to work with. They offer no support on this, and
have no forum or community.

My webserver is Linux, PHP 5.2.5 , MySQL 5.0.45, Apache 1.3.41

Could someone please show me how to make this happen? Maybe write one?
This has been a thorn in my side for a week. I'm not really a coder.
hora
Forum Newbie
Posts: 9
Joined: Mon May 05, 2008 10:17 pm

Re: HTTP GET help

Post by hora »

I'm not sure if I understand your problem exactly, but this is what I think:

You're gonna get a URL, that looks something like this:

http://www.whatever.c om/phpfile.php?did=12312,clid=2452345,confno=243

Obviously those numbers are random and I doubt that's the actual site, but the important thing is that the URL will contain something like this:

?variable=value,variable2=value2

Now in your PHP file, you can have something like this to check if those values are set:

if(isset($_GET(['variable'])){
// execute script
}

Or if you don't want to check for them first, you can just get all the values:

$a = $_GET['did'] // $a will be 12312
$b = $_GET['cid'] // $b will be 2452345

etc.

Do a google search for $_GET for more info.

Oh, and you'd want to send them a URL that has your values attached to it, like this:

http://whatever.com/file.php?STATUS=OK,PIN=1234
Post Reply