fsockopen https problem
| From: | Maycon de Oliveira | Date: | Sat, 11 Dec 2004 04:39:29 +0000 |
| Subject: | fsockopen https problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-204033@lists.php.net to get a copy of this message | ||
Hi, i have problem in my script, this error is Permission Danied (13)
<?
$host = "193.132.139.36";
$port = 443;
$path = "/gatekeeper/ink/quexry.asp"; //or .dll, etc. for authnet, etc.
//you will need to setup an array of fields to post with
//then create the post string
$formdata = array (
"type" => "full",
"originator" => "33",
"urn" => "2528",
"surname" => "appleton",
"submit" => "submit"
);
//build the post string
foreach($formdata AS $key => $val){
$poststring .= urlencode($key) . "=" . urlencode($val) . "&";
}
// strip off trailing ampersand
$poststring = substr($poststring, 0, -1);
$fp = fsockopen("https://".$host, $port, $errno,
$errstr, $timeout = 10);
if(!$fp){
//error tell us
echo "$errstr ($errno)\n";
}else{
//send the server request
fputs($fp, "POST $path HTTP/1.1\r\n");
fputs($fp, "Host: $host\r\n");
fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n");
fputs($fp, "Content-length: ".strlen($poststring)."\r\n");
fputs($fp, "Connection: close\r\n\r\n");
fputs($fp, $poststring . "\r\n\r\n");
//loop through the response from the server
while(!feof($fp)) {
echo fgets($fp, 4096);
}
//close fp - we are done with it
fclose($fp);
}
?>