stream| Function | web | download |stream| function | Download <script language= "VBScript" >
Function Bytes2bstr (vIn)
Dim Strreturn,i,thischarcode,innercode,hight8,low8,nextcharcode
Strreturn = ""
For i = 1 to LenB (vIn)
Thischarcode = AscB (MidB (vin,i,1))
If Thischarcode < &h80 Then
Strreturn = Strreturn & Chr (Thischarcode)
Else
Nextcharcode = AscB (MidB (vin,i+1,1))
Strreturn = Strreturn & Chr (CLng (thischarcode) * &h100 + CInt (nextcharcode))
i = i + 1
End If
Next
Bytes2bstr = Strreturn
End Function
</script>
<script language= "JavaScript" >
var xmlhttp= new ActiveXObject ("Msxml2.xmlhttp")
Xmlhttp.open ("Get", "http://www.csdn.net/", false)
Xmlhttp.send ()
Alert (BYTES2BSTR (XMLHTTP). Responsebody))
</script>
ASP version of:
<script language= "VBScript" >
Function Bytes2bstr (vIn)
Dim Strreturn,i,thischarcode,innercode,hight8,low8,nextcharcode
Strreturn = ""
For i = 1 to LenB (vIn)
Thischarcode = AscB (MidB (vin,i,1))
If Thischarcode < &h80 Then
Strreturn = Strreturn & Chr (Thischarcode)
Else
Nextcharcode = AscB (MidB (vin,i+1,1))
Strreturn = Strreturn & Chr (CLng (thischarcode) * &h100 + CInt (nextcharcode))
i = i + 1
End If
Next
Bytes2bstr = Strreturn
End Function
Dim XMLHTTP
Set Xmlhttp=server.createobject ("Msxml2.xmlhttp")
Xmlhttp.open "Get", "http://www.csdn.net/", False
Xmlhttp.send
Response.Write Bytes2bstr (XMLHTTP. Responsebody)
</script>
C # version of:
Http://www.ccw.com.cn/htm/center/prog/02_5_9_2.asp
Using System.IO;
Using System.Net;
Using System.Text;
In
private void Button1_Click (object sender, System.EventArgs e)
{
}
byte[] buf = new byte[38192];
HttpWebRequest request = (HttpWebRequest) webrequest.create (TextBox1.Text);
HttpWebResponse response = (HttpWebResponse) request. GetResponse ();
Stream Resstream = Response. GetResponseStream ();
int count = Resstream.read (buf, 0, buf.) Length);
TextBox2.Text = Encoding.Default.GetString (buf, 0, Count);
Resstream.close ();