Hi,
I am using this really handy function for submitting a form to paypal:
function httpSimulateFormSubmit($host, $method, $path, $data)
{
$fp = fsockopen("ssl://". $host, 443, $errno, $errstr, $timeout = 30);
if ($fp)
{
if ($method == 'GET')
$path .= '?' . $data;
fputs($fp, "$method $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($data) . "\r\n");
fputs($fp, "Connection: close\r\n\r\n");
if ($method == 'POST')
fputs($fp, $data);
while (!feof($fp))
$buf .= fgets($fp, 1024);
fclose($fp);
return $buf;
}
else
return FALSE;
}
And it works fantasitcally, however I'm not really sure what to do with the
$buf
that is returned. It is the raw transfer from the paypal server, including headers and HTML code. If i echo the returned value, I get the page as if it lived on my server. There are the raw headers at the top and what looks like the page except the images are broken and there is no css because all links resolve to being on my domain.
How do I trick my browser into reading the buffer as the http stream insetad of displaying it?
TIA,
Billy