Ajax accessing web site problem

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.
 
B

bruce barker

in Unix tcp streams are just a file open. In .net you use the TcpClient
classes.

-- bruce (sqlwork.com)
 
B

Ben

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top