Hi,
i am trying to send a header to a page using fput, then read the response that page sends, then set that response as a header for that page to set any cookies etc the page might want to set. My current code is as follows:
// Build the request string
$request = $varname1."=". urlencode($var1);
$request .= "&".$varname2."=" . urlencode($var2);
// Build the header
$header = "POST /page.htm HTTP/1.0\r\n";
$header .= "Content-type: application/x-www-form-urlencoded\r\n";
$header .= "Content-length: " . strlen($request) . "\r\n\r\n";
$fp = fsockopen('www.site.com', 80, &$err_num, &$err_msg, 30);
if ($fp)
{
// Send everything
fputs($fp, $header . $request);
// Get the response
while (!feof($fp))
$response .= fgets($fp, 128);
}
fclose ($fp);
$response=substr ($response, 0, strpos($response, "<"));
header ($response);
however this doesn't seem to work... any ideas?
thks,
elie