ASP help for PHP me
Discussion
Right, I'm familar with PHP and have been asked to convert a load of my PHP code into ASP. Specifically VB ASP.
The bit I'm stuggling with is as follows:
This function basically allows me to call another page on a different server. This is so I can parse the return before I display the result to the user. Is there a way of doing this in ASP?
cheers
>> Edited by KITT on Monday 8th August 14:56
The bit I'm stuggling with is as follows:
php said:
function httpPost($host, $path, $referer, $data) {
$fp = fsockopen($host, 80 );
fputs($fp, "POST ".$path." HTTP/1.0 " );
fputs($fp, "Host: ".$host." " );
fputs($fp, "Referer: ".$referer." " );
fputs($fp, "Content-type: application/x-www-form-urlencoded " );
fputs($fp, "Content-length: ".strlen($data)." " );
fputs($fp, " " );
fputs($fp, $data." " );
fputs($fp, " " );
$tmp_headers = "";
while ($str = trim(fgets($fp, 4096)))
$tmp_headers .= $str." ";
$tmp_body = "";
do {
$data = fread($fp, 4096);
if (strlen($data) == 0) {
break;
}
$tmp_body .= $data;
} while(true);
fclose($fp);
return $tmp_body;
}
This function basically allows me to call another page on a different server. This is so I can parse the return before I display the result to the user. Is there a way of doing this in ASP?
cheers
>> Edited by KITT on Monday 8th August 14:56
I think to do that in ASP you'll need to find a library that does the functions you need. I think the Microsoft Internet Controls COM Object should do the trick.
Your code will be something like
dim htmlObj, szRet, szPage
Set htmlObj = Server.CreateObject( "InetCtls.Inet" )
szPage = "http://theotherserver/thepage.asp"
szRet = htmlObj.OpenURL(szPage)
'now parse szRet
>> Edited by Don on Monday 8th August 16:56
Your code will be something like
dim htmlObj, szRet, szPage
Set htmlObj = Server.CreateObject( "InetCtls.Inet" )
szPage = "http://theotherserver/thepage.asp"
szRet = htmlObj.OpenURL(szPage)
'now parse szRet
>> Edited by Don on Monday 8th August 16:56
Gassing Station | Computers, Gadgets & Stuff | Top of Page | What's New | My Stuff


