Forum Home Forum Home > Computing > Webmasters
  New Posts New Posts RSS Feed - Reading remote sites in ASP.NET or PHP
  FAQ FAQ  Forum Search   Events   Register Register  Login Login


Forum LockedReading remote sites in ASP.NET or PHP

 Post Reply Post Reply
Author
Message
Administrator View Drop Down
Admin Group
Admin Group
Avatar

Joined: January/25/2003
Location: United States
Status: Offline
Points: 809
Post Options Post Options   Thanks (0) Thanks(0)   Quote Administrator Quote  Post ReplyReply Direct Link To This Post Topic: Reading remote sites in ASP.NET or PHP
    Posted: October/17/2003 at 6:17am
Hi,

In the past 2 days I've learned that both PHP and ASP.NET can easily retrieve information from remote sites. Finding the sample code wasn't as easy as I expected, especially for ASP.NET - so, I thought it would be useful if I post it here.

PHP sample code:
<?
    $file = fopen ("http://www.yahoo.com/", "r");
    while (!feof ($file)) {
        $line = fgets ($file, 1024);
        echo $line;
    }
    fclose($file);
?>

ASP.NET sample code:
<%
    dim snw As New System.Net.WebClient()
    dim data as Byte()

    data=snw.downloaddata("http://www.yahoo.com")
    response.write(Encoding.ASCII.GetString(data))
%>

Andy

Edited by Administrator
Back to Top
Sponsored Links


Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

All my sites | Web Wiz Hosting Services | Privacy policy