472,145 Members | 1,534 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,145 software developers and data experts.

Clipping a remote webpage with Javascript/XPath and including in a "local" webpage

I have searched this (and other) groups extensively, in addition to the
clj FAQ and the Web, and (to my surprise) this question doesn't come up
as often as I thought it would. Maybe this is because either is
patently impossible or I am not searching for the right thing. If
either of these is the case, of course, please let me know.

What I am trying to do is grab a little snippet of data from a remote
page based on user input in a form. Take a look at this page:
http://www.qrz.com/kb2gsd

What I want to do is: when a user types the callsign (in this case,
KB2GSD) into a form field, I want to execute an XPath query via
Javascript to automatically complete the Name, Location, etc from a web
page like the one listed above.

I can compose the requisite XPath query without a problem, and I'm
pretty sure I can create the code to initiate the query, but I'm not
sure how (if it's even possible) to execute such a query on a remote
page. I am somewhat familiar with the document.evaluate() method, but
is there a way to "evaluate" a page other than the one currently
loaded?

Thanks for reading and thanks for a reponse if you're able to help.

PB

Dec 12 '06 #1
2 1739
soren625 wrote:
I have searched this (and other) groups extensively, in addition to the
clj FAQ and the Web, and (to my surprise) this question doesn't come up
as often as I thought it would. Maybe this is because either is
patently impossible or I am not searching for the right thing. If
either of these is the case, of course, please let me know.

What I am trying to do is grab a little snippet of data from a remote
page based on user input in a form. Take a look at this page:
http://www.qrz.com/kb2gsd
Is the remote page in the same domain/server as your script page? That
is, the javascript security model will not allow you to contact a third
party site.

If the data is on your own servers then yes you can have javascript
contact the server and request the information. You can do this either
through javascript forms and submits via get and post. Or you can get
fancy and use AJAX to do the lookup without navigating to a new web page.

However, reading your post it appears you wish to extract this
information from a third party site, not under your control. This is
not possible in javascript, it is possible if you have access to
server-side languages like php,perl,etc. Which will direct you to a
different newsgroup.

---------------------------------------------------------------------------
http://www.hunlock.com
$FA
Dec 12 '06 #2
On Dec 12, 8:49 am, pcx99 <x...@x.comwrote:

......
However, reading your post it appears you wish to extract this
information from a third party site, not under your control. This is
not possible in javascript, it is possible if you have access to
server-side languages like php,perl,etc. Which will direct you to a
different newsgroup.
That's what I was afraid of ... I know Javascript is *very* security
conscious. You answered my question nonetheless: I'm off to try a
solution using PHP (hopefully) or (if need be) Perl.

Thanks for a quick reply and a concise and helpful answer.

PB

Dec 12 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by jack | last post: by
reply views Thread by Tom Clement | last post: by
3 posts views Thread by Robin Tucker | last post: by
reply views Thread by Saiars | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.