Re: [PHP] Getting Information from a CGI POST

2001-07-04 Thread Don Read


On 03-Jul-01 Brad Hubbard wrote:
 On Tue,  3 Jul 2001 02:51, Don Read wrote:
 
 $pstr='FltNum=2972page=fiselectDay=July+02';
 $fp=openpost('dps2.usairways.com', '/cgi-bin/fi', $pstr);

 // i'm not so sure about that selectDay, javascript ain't my thing.
 
 This is implementation dependant (it's using an array they've created 
 (monthNames should be defined futher up the page within a script tag) so
 it 
 could be anything) 

Understood.

   there doesn't appear to be a + in there though so it's 
 more likely selectDay=July02 or selectDay=0702 or selectDay=702.
 
 

The OP :
 script
todayMonth = monthNames[today.getMonth() + 1];
document.write( 'option value=\' + todayMonth + '
' + today.getDate() + '\today/option');

I expected the todayMonth+ ' ' +

 Cheers,
 Brad

-- 
Don Read   [EMAIL PROTECTED]
-- 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.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Getting Information from a CGI POST

2001-07-03 Thread Brad Hubbard

On Tue,  3 Jul 2001 02:51, Don Read wrote:

 $pstr='FltNum=2972page=fiselectDay=July+02';
 $fp=openpost('dps2.usairways.com', '/cgi-bin/fi', $pstr);

 // i'm not so sure about that selectDay, javascript ain't my thing.

This is implementation dependant (it's using an array they've created 
(monthNames should be defined futher up the page within a script tag) so it 
could be anything) there doesn't appear to be a + in there though so it's 
more likely selectDay=July02 or selectDay=0702 or selectDay=702.


Cheers,
Brad

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Getting Information from a CGI POST

2001-07-02 Thread Clayton Dukes

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 [EMAIL PROTECTED]
To: Clayton Dukes [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
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   [EMAIL PROTECTED]
 -- 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.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Getting Information from a CGI POST

2001-07-02 Thread Don Read


On 02-Jul-01 Clayton Dukes wrote:
 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?
 

you'll build the string yourself before the call:

$pstr='FltNum=2972page=fiselectDay=July+02';
$fp=openpost('dps2.usairways.com', '/cgi-bin/fi', $pstr);

// i'm not so sure about that selectDay, javascript ain't my thing.

Regards,
-- 
Don Read   [EMAIL PROTECTED]
-- 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.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Getting Information from a CGI POST

2001-07-01 Thread Jason Murray

 Can this be done? If so, can someone point me in the right direction? 
 Specifically, how to get the CGI Post data returned from thier server?

As a starting point, grab their form, including all the javascript
associated with it, and put it onto your own page.

Change the FORM tag to submit to a PHP script, and in that PHP
script put ? phpInfo(); ? ... look at the data you get in, 
in either $HTTP_POST_VARS or $HTTP_GET_VARS and write a PHP 
script to replicate that data. Then, use PHP's curl functions 
to post or get that data to the remote CGI script.

This would be hard to do for every airline though, since they all 
have different online forms.

Jason

-- 
Jason Murray
[EMAIL PROTECTED]
Web Developer, Melbourne IT
Work now, freak later!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Getting Information from a CGI POST

2001-07-01 Thread Don Read


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   [EMAIL PROTECTED]
-- 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.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]