l*****0 发帖数: 179 | 1 The following code written in JAVA should go to a website and download the
html and parse the contents to find the distance between 2 addresses.
But my problem is , The website uses Javascript to return the value of the
distance which JAVA cannot see it when it downloads the html. It's said I
should call the JAVAscript in my JAVA code which I have no clue.
code:
import java.lang.*;
import java.io.*;
import java.net.*;
import java.util.*;
import java.util.regex.*;
|
g*****g 发帖数: 34805 | 2 try htmlunit, they build in a javasript engine so you should be able
to get whatever calculated by js.
【在 l*****0 的大作中提到】 : The following code written in JAVA should go to a website and download the : html and parse the contents to find the distance between 2 addresses. : But my problem is , The website uses Javascript to return the value of the : distance which JAVA cannot see it when it downloads the html. It's said I : should call the JAVAscript in my JAVA code which I have no clue. : code: : import java.lang.*; : import java.io.*; : import java.net.*; : import java.util.*;
|
Z****e 发帖数: 2999 | 3 try a different map provider, especially those providing mobile version of
map website, e.g.
http://m.live.com/search/search.aspx?A=routeview&D=MAP&SA=121+Amelia+St%2c+++Mc+Kees+Rocks%2c+PA+15136-3432&EA=300+Ewing+Rd%2c+++Mc+Kees+Rocks%2c+PA+15136-1886
This page has the distance data in plain text
You should know that, most mapping website use JS in web version or provide
a client app in mobile version for exactly this reason: making it difficult
to "steal" their service, so if you use it somewh
【在 l*****0 的大作中提到】 : The following code written in JAVA should go to a website and download the : html and parse the contents to find the distance between 2 addresses. : But my problem is , The website uses Javascript to return the value of the : distance which JAVA cannot see it when it downloads the html. It's said I : should call the JAVAscript in my JAVA code which I have no clue. : code: : import java.lang.*; : import java.io.*; : import java.net.*; : import java.util.*;
|
l*****0 发帖数: 179 | 4 I haven't tried it. are you sure it allows me to manipulate the javacript
functions used by other websites instead of mine?
【在 g*****g 的大作中提到】 : try htmlunit, they build in a javasript engine so you should be able : to get whatever calculated by js.
|
l*****0 发帖数: 179 | 5 pure research purpose.
The one you provided looks cool.
For your benefit. one big drawback: when this website doesn't recognize an
address, it would use an address the website thinks the best without asking
your advice. Sometimes the result is very ridiculous.
I tested. The correct one should be 3.72 miles. This website returns 326.1
mi (about 5 hours, 18 minutes with traffic).
provide
difficult
get
【在 Z****e 的大作中提到】 : try a different map provider, especially those providing mobile version of : map website, e.g. : http://m.live.com/search/search.aspx?A=routeview&D=MAP&SA=121+Amelia+St%2c+++Mc+Kees+Rocks%2c+PA+15136-3432&EA=300+Ewing+Rd%2c+++Mc+Kees+Rocks%2c+PA+15136-1886 : This page has the distance data in plain text : You should know that, most mapping website use JS in web version or provide : a client app in mobile version for exactly this reason: making it difficult : to "steal" their service, so if you use it somewh
|
g*****g 发帖数: 34805 | 6 It allows you to have the page as you see it. Not sure it supports all js,
but at least you can try.
【在 l*****0 的大作中提到】 : I haven't tried it. are you sure it allows me to manipulate the javacript : functions used by other websites instead of mine?
|
Z****e 发帖数: 2999 | 7 it gives no error indication when address is not found
but with the addresses in your link, it should be possible to accurately
determine the distance, otherwise probably you did not provide address in
the correct format?
asking
【在 l*****0 的大作中提到】 : pure research purpose. : The one you provided looks cool. : For your benefit. one big drawback: when this website doesn't recognize an : address, it would use an address the website thinks the best without asking : your advice. Sometimes the result is very ridiculous. : I tested. The correct one should be 3.72 miles. This website returns 326.1 : mi (about 5 hours, 18 minutes with traffic). : : provide : difficult
|
l*****0 发帖数: 179 | 8 thanks all. I'm ready to send out the forum money. |
l*****0 发帖数: 179 | 9 the money has been sent to zeeGee and goodbug. ...
May I know how to make money here? |
k***r 发帖数: 4260 | 10 I'm not familiar with map service but I suppose it's better to use their
webservice rather than parsing the page. They may change the page anytime
they want and that will break your site.
【在 l*****0 的大作中提到】 : The following code written in JAVA should go to a website and download the : html and parse the contents to find the distance between 2 addresses. : But my problem is , The website uses Javascript to return the value of the : distance which JAVA cannot see it when it downloads the html. It's said I : should call the JAVAscript in my JAVA code which I have no clue. : code: : import java.lang.*; : import java.io.*; : import java.net.*; : import java.util.*;
|