I want to grab a HTML page generated by an ASP script (I know nothing about ASP) runing in the other host.They first validate username and password in an "login.htm" page using
<form action="login.asp" method="POST">
Here is my problem.It seems that I cant pass the correct parameters to "login.asp"
The code below works fine if the remote script is PHP.
<title> abc </title>
<body>
<?
/* sendToHost
* ~~~~~~~~~~
* Params:
* $host - Just the hostname. No http:// or
/path/to/file.html portions
* $method - get or post, case-insensitive
* $path - The /path/to/file.html part
* $data - The query string, without initial question mark
* $useragent - If true, 'MSIE' will be sent as
the User-Agent (optional)
*
* Examples:
* sendToHost('* sendToHost('* 'param=First+Param&second=Second+param');
*/
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\n"
fputs($fp, "Host: $host\n"
fputs($fp, "Content-type: application/x-fputs($fp, "Content-length: " . strlen($data) . "\n"
if ($useragent)
fputs($fp, "User-Agent: MSIE\n"
fputs($fp, "Connection: close\n\n"
if ($method == 'POST')
fputs($fp, $data);
while (!feof($fp))
$buf .= fgets($fp,128);
fclose($fp);
echo $buf;
}
?>
<?
sendToHost(' );
</body>
I receive this result:
HTTP/1.1 100 Continue Server: Microsoft-IIS/4.0 Date: Mon, 11 Mar 2002 22:32:07 GMT HTTP/1.1 302 Object moved Server: Microsoft-IIS/4.0 Date: Mon, 11 Mar 2002 22:32:07 GMT Connection: close Location: links.asp Content-Length: 130 Content-Type: text/html Set-Cookie: ASPSESSIONIDGQQQQQEC=MHFPIANDPEJBBPHBIMCCGPNA; path=/ Cache-control: private
Object Moved
This object may be found here.
Could you guys please help me with any idea how to solve this problem?
I really need help!!!!!!
<form action="login.asp" method="POST">
Here is my problem.It seems that I cant pass the correct parameters to "login.asp"
The code below works fine if the remote script is PHP.
<title> abc </title>
<body>
<?
/* sendToHost
* ~~~~~~~~~~
* Params:
* $host - Just the hostname. No http:// or
/path/to/file.html portions
* $method - get or post, case-insensitive
* $path - The /path/to/file.html part
* $data - The query string, without initial question mark
* $useragent - If true, 'MSIE' will be sent as
the User-Agent (optional)
*
* Examples:
* sendToHost('* sendToHost('* 'param=First+Param&second=Second+param');
*/
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\n"
fputs($fp, "Host: $host\n"
fputs($fp, "Content-type: application/x-fputs($fp, "Content-length: " . strlen($data) . "\n"
if ($useragent)
fputs($fp, "User-Agent: MSIE\n"
fputs($fp, "Connection: close\n\n"
if ($method == 'POST')
fputs($fp, $data);
while (!feof($fp))
$buf .= fgets($fp,128);
fclose($fp);
echo $buf;
}
?>
<?
sendToHost(' );
</body>
I receive this result:
HTTP/1.1 100 Continue Server: Microsoft-IIS/4.0 Date: Mon, 11 Mar 2002 22:32:07 GMT HTTP/1.1 302 Object moved Server: Microsoft-IIS/4.0 Date: Mon, 11 Mar 2002 22:32:07 GMT Connection: close Location: links.asp Content-Length: 130 Content-Type: text/html Set-Cookie: ASPSESSIONIDGQQQQQEC=MHFPIANDPEJBBPHBIMCCGPNA; path=/ Cache-control: private
Object Moved
This object may be found here.
Could you guys please help me with any idea how to solve this problem?
I really need help!!!!!!