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]

Reply via email to