I also tried the following function:
function sendToHost($host,$method,$path,$data,$useragent=0)
{
// Supply a default method of GET if the one passed was empty
if (empty($method)) {
$method = 'GET';
}
$method = strtoupper($method);
$fp = fsockopen($host, 80);
if ($method == 'GET') {
$path .= '?' . $data;
}
fputs($fp, "$method $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($data) . "\r\n");
if ($useragent) {
fputs($fp, "User-Agent: MSIE\r\n");
}
fputs($fp, "Connection: close\r\n\r\n");
if ($method == 'POST') {
fputs($fp, $data);
}
while (!feof($fp)) {
$buf .= fgets($fp,128);
}
fclose($fp);
return $buf;
}
$host = 'www.ftv.com';
$method = 'post';
$path = 'http://www.ftv.com/ftvclub/login_finish.asp';
$data = 'email=lvi@ukr.net&password=password';
echo sendToHost($host,$method,$path,$data,$useragent=0);
As a result I received:
HTTP/1.1 100 Continue Server: Microsoft-IIS/5.0 Date: Wed, 28 Apr 2004 13:57:49 GMT HTTP/1.1 302 Object moved Server: Microsoft-IIS/5.0 Date: Wed, 28 Apr 2004 13:57:49 GMT Connection: close Location: ftvclub_member.asp Content-Length: 158 Content-Type: text/html Expires: Tue, 27 Apr 2004 13:57:49 GMT Set-Cookie: ASPSESSIONIDASSQRQCD=CDHNAMJDPEBGIGCCGIHCBNBI; path=/ Cache-control: private
How can I use this info to establish connection to scan the site with php code? Would be very thankful for any help.