You are here: Re: JavaScript to Fetch Text « HTML « IT news, forums, messages
Re: JavaScript to Fetch Text

Posted by Roy Schestowitz on 12/14/80 11:26

__/ [Vladdy] on Tuesday 13 September 2005 00:14 \__

> Roy Schestowitz wrote:
>> <SNIP
>>
>> [CODE]
>>
>> function showInfo()
>> {
>> oxmlhttp =getFile('/robots.txt');
>> document.write(oxmlhttp);
>> }
>>
>> [/CODE]
>>
>> but the following will not
>>
>>
>> [CODE]
>>
>> function showInfo()
>> {
>> oxmlhttp =getFile('http://example.org/robots.txt');
>> document.write(oxmlhttp);
>> }
>>
>> [/CODE]
>>
>> Is there a simple way around this? The text remains 'null' if I try the
>> latter, which is why I need to access a machine of mine from the Web
>> server.
>>
>> Thanks again,
>>
>> Roy
>
> As I mentioned in my original post, the xmlhttp file access only works
> within the same domain - security reasons. In the first example, the
> same domain is assured by using the relative URL, in the second one, it
> may not be (for example, you may need to add "www." to match the domain
> of the page containing script; or it not work at all with the full
> domain name - I have never tried it for the aformentioned reason)

That's what I was worried about. It apparently discourages scraping, which
in this case is something I want to do benevolently -- grabbing content
from my own machine. I can think of alternative solutions involving a
grabber like wget, but that would take me too far.

Many thanks,

Roy

--
Roy S. Schestowitz | "Signature pending approval"
http://Schestowitz.com | SuSE Linux | PGP-Key: 74572E8E
3:50am up 18 days 21:24, 3 users, load average: 0.40, 0.65, 0.73

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация