Okay, I am working on a credit card validation script, I have it
working perfectly (saving the return information from the server to a
variable and echoing it for now) other than this weird error on the
fgets() line. I can't seem to figure out the problem, the code is
below, any help is appreciated!
<?php
$host = "secure.authori ze.net";
$port = 443;
$path = "/gateway/transact.dll";
$formdata = array ("x_form_post_d ata_here" => "value");
foreach($formda ta AS $key => $val){
$poststring .= urlencode($key) . "=" . urlencode($val) . "&";
}
$poststring = substr($poststr ing, 0, -1);
$fp = fsockopen("ssl://".$host, $port, $errno, $errstr, $timeout =
30);
if(!$fp){
echo "$errstr ($errno)\n";
}else{
fputs($fp, "POST $path HTTP/1.0\r\n");
fputs($fp, "Host: $host\r\n");
fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n" );
fputs($fp, "Content-length: ".strlen($posts tring)."\r\n");
fputs($fp, "Connection : close\r\n\r\n") ;
fputs($fp, $poststring . "\r\n\r\n") ;
while(!feof($fp )) {
$out_put_string .= fgets($fp, 4096); //<== HERE IS THE ERROR LINE #
}
fclose($fp);
}
echo $out_put_string ;
?>
working perfectly (saving the return information from the server to a
variable and echoing it for now) other than this weird error on the
fgets() line. I can't seem to figure out the problem, the code is
below, any help is appreciated!
<?php
$host = "secure.authori ze.net";
$port = 443;
$path = "/gateway/transact.dll";
$formdata = array ("x_form_post_d ata_here" => "value");
foreach($formda ta AS $key => $val){
$poststring .= urlencode($key) . "=" . urlencode($val) . "&";
}
$poststring = substr($poststr ing, 0, -1);
$fp = fsockopen("ssl://".$host, $port, $errno, $errstr, $timeout =
30);
if(!$fp){
echo "$errstr ($errno)\n";
}else{
fputs($fp, "POST $path HTTP/1.0\r\n");
fputs($fp, "Host: $host\r\n");
fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n" );
fputs($fp, "Content-length: ".strlen($posts tring)."\r\n");
fputs($fp, "Connection : close\r\n\r\n") ;
fputs($fp, $poststring . "\r\n\r\n") ;
while(!feof($fp )) {
$out_put_string .= fgets($fp, 4096); //<== HERE IS THE ERROR LINE #
}
fclose($fp);
}
echo $out_put_string ;
?>
Comment