[quoted text, click to view] > I've read other threads that say I can use the .NET classes WebRequest
> and WebResponse, but the link referenced has sample VB.NET or C# code
I don't know anything about J++. Here is an example I wrote with Request and
Response.
public class Class1
{
public Class1()
{
System.Net.WebRequest request =
System.Net.WebRequest.Create("http://www.contoso.com");
System.Net.WebResponse response = request.GetResponse();
// Please use a stream buffer for speed.
System.IO.Stream stream = response.GetResponseStream();
System.Console.WriteLine("____________________________");
int byt = 0;
while ( (byt = stream.ReadByte()) != -1 )
{
System.Console.Write( ""+(char)byt );
}
stream.Close();
System.Console.WriteLine();
System.Console.WriteLine("____________________________");
System.Uri uri = response.get_ResponseUri();
System.Console.WriteLine(" response: "+uri );
System.Console.WriteLine();
System.Console.WriteLine("____________________________");
long lenth = response.get_ContentLength();
System.Console.WriteLine(" Lenth: "+lenth );
System.Console.WriteLine();
System.Console.WriteLine("____________________________");
String type = new String( response.get_ContentType() );
System.Console.WriteLine(" Type: "+type );
System.Console.WriteLine();
System.Console.WriteLine("____________________________");
System.Net.WebHeaderCollection coll = response.get_Headers();
for ( int counter=0; counter < coll.get_Count(); counter++ )
{
System.Console.WriteLine(" : "+coll.get_Item(counter) );
}
System.Console.WriteLine("____________________________");
System.Console.WriteLine();
response.Close();
}
/** @attribute System.STAThread() */
public static void main(String[] args)
{
new Class1();
}
}
Regards,
Lars-Inge Tønnessen
www.larsinge.com