1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to access remote URL

Discussion in 'JavaScript' started by freeven, Apr 20, 2007.

  1. #1
    This is my first post. I have some basic programming knowledge, but I'm new to javascript. I'm trying to create a script that will

    1) retrieve specific information from a remote page (without displaying the page);

    2) reformat that information;

    3) display the reformatted information on my page.

    I've been reading some online guides and tutorials, and I think I can figure out how to do steps 2 and 3. However, I'm lost as to how to do step 1. The closest thing I've found in the reference guides is the "location" attribute (not sure if attribute is the proper term), but that doesn't look like what I need, since I don't want to actually display the page. I just need to be able to read it in and extract some information.

    Can anyone point a newbie in the right direction?

    Thanks.
     
    freeven, Apr 20, 2007 IP
  2. webcosmo

    webcosmo Notable Member

    Messages:
    5,840
    Likes Received:
    153
    Best Answers:
    2
    Trophy Points:
    255
    #2
    From my experience I dont thing Javascript has such capability of reading a file from a remote server. Its a client side script which runs on user browser and do perform things there not outside. But as alternate you can use other scripting languages like cgi/php/asp etc to fetch the url and read the content in a variable.
     
    webcosmo, Apr 20, 2007 IP
  3. Aragorn

    Aragorn Peon

    Messages:
    1,491
    Likes Received:
    72
    Best Answers:
    1
    Trophy Points:
    0
    #3
    Yes, it is possible. Use Ajax to query the remote page. Process the response from the server. And display it in your page.
     
    Aragorn, Apr 21, 2007 IP
  4. MattD

    MattD Peon

    Messages:
    161
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Just use XMLHttpRequest to get it
     
    MattD, Apr 22, 2007 IP
  5. costin_trifan

    costin_trifan Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I use ASP.NET and Visual Basic.NET to retrieve and display all the content that the remote page has in the <head> and </head>.
    If that helps you, then check out my blog ["http://jasp-costin.blogspot.com/2007/04/crawling-competitors-web-site.html"].

    HTH.
     
    costin_trifan, Apr 23, 2007 IP
  6. freeven

    freeven Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Thanks for the replies. Seems there are a number of solutions. I ended up using PHP instead of javascript as it had the built in functions to do just what I needed.

    Thanks.
     
    freeven, Apr 23, 2007 IP