Re: Getting Information from a CGI POST
| From: | Clayton Dukes | Date: | Mon, 02 Jul 2001 12:57:02 +0000 |
| Subject: | Re: Getting Information from a CGI POST | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-55824@lists.php.net to get a copy of this message | ||
Don,
Thanks for the info.
I'm a bit confused,
When I call the function, what is the syntax as it applies to my form?
ie:
openpost ("dps2.usairways.com, /cgi-bin/fi, FltNum=2972 page=fi");
I know this doesn't work, but do you see what I mean?
Forgive my ignorance, I'm still learning :-)
Also, how do I set more than one NAME= VALUE= pair?
As a reference, here's the form I am getting the info from:
-------------------------------------------------
<form name="flightStatusForm" method="post"
action="http://dps2.usairways.com/cgi-bin/fi">
<input type="text" name="FltNum" size="6"
maxlength="4"></td>
<input type="hidden" name="page" value="fi">
<select class="bodytext" name="selectDay"
size="1">
<script>
todayMonth = monthNames[today.getMonth() + 1];
document.write( '<option value=\"' + todayMonth + '
' + today.getDate() + '\">today</option>');
tomorrowMonth = monthNames[tomorrow.getMonth() + 1];
document.write( '<option value=\"' + tomorrowMonth +
' ' + tomorrow.getDate() + '\">tomorrow</option>');
yesterdayMonth = monthNames[yesterday.getMonth() +
1];
document.write( '<option value=\"' + yesterdayMonth
+ ' ' + yesterday.getDate() + '\">yesterday</option>');
</script>
</select>
</form>
-------------------------------------------------
TIA!
Clayton Dukes
CCNA, CCDA, CCDP, CCNP
Download Free Essays, Term Papers and Cisco Training from http://www.gdd.net
----- Original Message -----
From: "Don Read" <dread@texas.net>
To: "Clayton Dukes" <cdukes@cdukes.com>
Cc: <php-general@lists.php.net>
Sent: Monday, July 02, 2001 12:01 AM
Subject: RE: [PHP] Getting Information from a CGI POST
>
> On 02-Jul-01 Clayton Dukes wrote:
> > Hi everyone,
> >
> > Is it possible to get information from a POST to a cgi and return the
value?
>
> Yes.
>
> function openpost($host, $path, $poststr) {
> $errno=0;
> $errstr='';
>
> $hdr=sprintf("POST /%s HTTP/1.0\r\nContent-Length: %d\r\n",
> $path, strlen($poststr));
> $hdr .="Content-type: application/x-www-form-urlencoded\r\n";
> $hdr .="Accept: text/html\r\nAccept: text/plain\r\n";
> $hdr .="User-Agent: Mozilla/1.0\r\n\r\n";
>
> $fp = fsockopen($host , 80, &$errno, &$errstr, 45);
> if (!$fp) {
> echo "$host open error: $errstr $errno .\n";
> return(0);
> } else {
> fputs($fp,$hdr.$poststr);
> return($fp);
> }
> }
>
> while (!feof($fp)) {
> $buff=fgets($fp, 1024);
> dofoo($buff);
> }
> fclose($fp);
>
> > Isn't there a way to have PHP go and check this onec every x minutes and
> > return the status?
>
> Yep, there is.
>
> >
> > Can this be done?
>
> Yes.
>
> Regards,
> --
> Don Read dread@texas.net
> -- It's always darkest before the dawn. So if you are going to
> steal the neighbor's newspaper, that's the time to do it.