Ajax accessing web site problem

  • Thread starter Thread starter Ben
  • Start date Start date
B

Ben

Hi,
I'm in the process of learning Ajax, and trying to convert examples out
of a book to work in a C#.NET environment. I've hit a snag and need some
guidance.
The example I'm working on attempts to access an outside web site
(GoogleSelect, in fact), and does so by using a PHP script. I'd like to do
this without PHP, using only .NET / Ajax functionality.
The PHP script uses its 'fopen(http://...)' call to access the web site,
and returns (via its $echo command) what the web site returned.
How can I (if it's even possible) write an Ajax method in my page's
code-behind that makes a call to another web site and returns what that web
site provides, doing in essence the same thing the PHP script does.
Can it be done? How?
Thanks,
Ben

If you need further info: bf001<removethis>@abovetheline.biz.
 
in Unix tcp streams are just a file open. In .net you use the TcpClient
classes.

-- bruce (sqlwork.com)
 
Ok, I found the answer:

Create an HttpWebRequest object pointing directly to the full URL (with
parameters).
Call the object's GetResponse method to get an HttpWebResponse object.
Feed that into a StreamReader and use the ReadToEnd method to extract
the string reutrned from the web request.

Thanks, all.
Ben
 
Back
Top