www.webdeveloper.com
Results 1 to 11 of 11

Thread: How can I grab text from another site on the fly?

  1. #1
    Join Date
    Jan 2006
    Location
    Boston
    Posts
    30

    Question How can I grab text from another site on the fly?

    I am trying to develop a system where if a user hovers over a particular link, a little tool-tip box (just a div) will show up, show a 'thinking' graphic if need be, and grab a specific chunk of text from our wiki. I've got the text in the wiki in a unique wrapper, I just don't know how to execute the actual grabbing process. Is this possible with j/s? What else should I look into from here?

  2. #2
    Join Date
    Dec 2004
    Posts
    8,637
    Don't know what wiki is, but you'll need a DHTML Tooltip Popup script and perhaps you're looking for Ajax to retrieve the information from the server?

    http://jibbering.com/2002/4/httprequest.html

  3. #3
    Join Date
    Jan 2005
    Location
    Los Angeles, CA
    Posts
    4,887
    Wiki is an online encyclopedia:
    http://en.wikipedia.org/wiki/Main_Page

    Since Wiki is an external website and JavaScript is very limited, requesting a page from wikipedia.org would cause a cross-domain permission denied security error within your own personal domain. Ajax is supposed to only be used for requesting pages within the same domain. Read up on the work arounds available for cross-domain http requests:
    http://www.xml.com/pub/a/2005/11/09/...d-harmful.html
    Id personally use PHP or an Apache Proxy (page 2 in the above link).
    Last edited by Ultimater; 05-31-2006 at 02:28 PM.

  4. #4
    Join Date
    Dec 2004
    Posts
    8,637
    Quote Originally Posted by Ultimater
    Wiki is an online encyclopedia:
    http://en.wikipedia.org/wiki/Main_Page

    Since Wiki is an external website ...
    I know what WikiPedia is, but are you sure that is what the OP is talking about? The OP said:
    Quote Originally Posted by ericdfields
    ...grab a specific chunk of text from our wiki...

  5. #5
    Join Date
    Jan 2005
    Location
    Los Angeles, CA
    Posts
    4,887
    Nope, I'm not sure if he is talking about wikipedia.org or not. Now that you bring it to my attention, I admit I'm probably wrong in regard to that. However I do know he's working with an external domain as it is mentioned in the thread title so therefore the rest of my post should still be of some additional guidance on top of your initial post.
    Last edited by Ultimater; 05-31-2006 at 04:48 PM.

  6. #6
    Join Date
    Dec 2004
    Posts
    8,637
    True, but are the following considered cross-domain? ...or, not?

    www.domain.com
    wiki.domain.com

    Two sites -- one domain, yes?

  7. #7
    Join Date
    Jan 2005
    Location
    Los Angeles, CA
    Posts
    4,887
    Two subdomains would encounter a permission denied security error. "Two sites" is a better way to word it. Should I call it a cross-site permission denied security error in the future? It sounds funny but defiantly more accurate
    Last edited by Ultimater; 05-31-2006 at 06:12 PM.

  8. #8
    Join Date
    Dec 2004
    Posts
    8,637
    OK, so you're saying that it is not really a cross-domain security restriction.
    Instead, it is a cross-server security restriction.

  9. #9
    Join Date
    Jan 2005
    Location
    Los Angeles, CA
    Posts
    4,887
    That is correct. Ok, I'll call it a "cross-server permission denied security error" in the future.

  10. #10
    Join Date
    Jan 2006
    Location
    Boston
    Posts
    30
    Wow... an abundance of information. Thanks a lot.

    For the record, this would be happening within the same domain. I want my site at xyz.com to pull info from wiki.xyz.com.

    In my own research, i found that wiki's do not identify paragraphs or sections in any particular way, so i think i'd also have to wrap the text i want to grab in an id'd div.

  11. #11
    Join Date
    Dec 2004
    Posts
    8,637
    Quote Originally Posted by ericdfields
    For the record, this would be happening within the same domain. I want my site at xyz.com to pull info from wiki.xyz.com.
    Ya, but that is part of the question.
    Quote Originally Posted by phpnovice
    True, but are the following considered cross-domain? ...or, not?

    www.domain.com
    wiki.domain.com

    Two sites -- one domain, yes?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles