f*******r 发帖数: 901 | 1 我们经常使用设备生产商网站上的一个设备选择程序。通过这个程序,我们输入一些参
数,然后点一个计算的键,然后就得到了我们想计算量。这个过程是手动的。
现在需要计算大量的数据,比如几千组,然后需要把计算的结过和输入这些参数存放在
一个文件里。如果手动的来实现的话,太麻烦了。不知道有没有什么方法,能编一个程
序,然这个程序替我不停的输入参数,然后把得到结果存到一个文件里。我刚才看了一
下,设备生产商网站上的那个程序是放在一个*.php网页里的。
希望这里的大牛们不吝赐教!谢谢! |
N***m 发帖数: 4460 | 2 直接提交代参数的url,然后抓取网页里面你想要的内容。
【在 f*******r 的大作中提到】 : 我们经常使用设备生产商网站上的一个设备选择程序。通过这个程序,我们输入一些参 : 数,然后点一个计算的键,然后就得到了我们想计算量。这个过程是手动的。 : 现在需要计算大量的数据,比如几千组,然后需要把计算的结过和输入这些参数存放在 : 一个文件里。如果手动的来实现的话,太麻烦了。不知道有没有什么方法,能编一个程 : 序,然这个程序替我不停的输入参数,然后把得到结果存到一个文件里。我刚才看了一 : 下,设备生产商网站上的那个程序是放在一个*.php网页里的。 : 希望这里的大牛们不吝赐教!谢谢!
|
f*******r 发帖数: 901 | 3 谢谢,楼上的兄台。我不是学cs的,能否说的细一点?用什么语言? |
N***m 发帖数: 4460 | 4 String url = aaa.com/bbb.php?param1=xxx¶m2=xxx...
String[][] result = new connection(url).get();
StringTokenizer st = ...;
for(String s:st) {
analyze s and get what you want;
save_to_file();
}
不知道你是不是这个意思?
【在 f*******r 的大作中提到】 : 谢谢,楼上的兄台。我不是学cs的,能否说的细一点?用什么语言?
|
f*******r 发帖数: 901 | 5 我来贴一张图吧。
我想让程序替我完成的事情就是:
1. 输入:"hot water temperature", "cold water temperature" and "wet bulb
temperature".
2. 点击“Calculate”键。
3. Flow rate 里就会出现计算出的流量。将 Flow rate 存入一个文件。
然后继续这个循环,直到所有的数据都计算完毕。
谢谢Natom兄台指点。
【在 f*******r 的大作中提到】 : 我们经常使用设备生产商网站上的一个设备选择程序。通过这个程序,我们输入一些参 : 数,然后点一个计算的键,然后就得到了我们想计算量。这个过程是手动的。 : 现在需要计算大量的数据,比如几千组,然后需要把计算的结过和输入这些参数存放在 : 一个文件里。如果手动的来实现的话,太麻烦了。不知道有没有什么方法,能编一个程 : 序,然这个程序替我不停的输入参数,然后把得到结果存到一个文件里。我刚才看了一 : 下,设备生产商网站上的那个程序是放在一个*.php网页里的。 : 希望这里的大牛们不吝赐教!谢谢!
|
N***m 发帖数: 4460 | 6 和我原来想的一样。
你把url地址告诉我,我来做做看
【在 f*******r 的大作中提到】 : 我来贴一张图吧。 : 我想让程序替我完成的事情就是: : 1. 输入:"hot water temperature", "cold water temperature" and "wet bulb : temperature". : 2. 点击“Calculate”键。 : 3. Flow rate 里就会出现计算出的流量。将 Flow rate 存入一个文件。 : 然后继续这个循环,直到所有的数据都计算完毕。 : 谢谢Natom兄台指点。
|
f*******r 发帖数: 901 | 7 兄台谢谢了。
这个网站要输入用户名和密码,还要点好多才能进入。因为保密的原因我就不再这里贴
url了,请Natom谅解阿。
兄台,能否指点一下,用什么语言?程序编成了,怎么编译,怎么运行呢? |
N***m 发帖数: 4460 | 8 how about java?
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
public class Main {
/**
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException {
// I use this url to test;
// not sure in your case since it is access restricted.
URL url = new URL("http://www.codeguru.com/forum/showthread.php?threadid=505119");
URLConnection conn = url.openConnection();
InputStream in = url.openStream();
BufferedReader bReader = new BufferedReader(new
InputStreamReader(in,"utf-8"));
String line;
while ( (line = bReader.readLine()) != null) {
System.out.println(line);
//analyze "line" to see if it contains returned data that
you are interested;
}
in.close();
}
}
【在 f*******r 的大作中提到】 : 兄台谢谢了。 : 这个网站要输入用户名和密码,还要点好多才能进入。因为保密的原因我就不再这里贴 : url了,请Natom谅解阿。 : 兄台,能否指点一下,用什么语言?程序编成了,怎么编译,怎么运行呢?
|
f*******r 发帖数: 901 | 9 兄台多谢了。我没有过这方面的经验,语言没有问题,但是怎么运行呢? |
t****t 发帖数: 6806 | 10 你连程序都不会运行, 我劝你还是雇个人干这活算了, 这又不是一两句话说得清楚的.
【在 f*******r 的大作中提到】 : 兄台谢谢了。 : 这个网站要输入用户名和密码,还要点好多才能进入。因为保密的原因我就不再这里贴 : url了,请Natom谅解阿。 : 兄台,能否指点一下,用什么语言?程序编成了,怎么编译,怎么运行呢?
|
|
|
N***m 发帖数: 4460 | 11 忘记写读文件的过程了。//
你自己google吧,java的东西一找一大堆,很容易看懂的。
【在 f*******r 的大作中提到】 : 兄台多谢了。我没有过这方面的经验,语言没有问题,但是怎么运行呢?
|
f*******r 发帖数: 901 | 12 兄台,我想问一下,这个Java程序, 是不是就是像我的C++程序一样,在一个编译器里
面(我用Visual C++ Experss),编译了,然后直接运行就行了。
还是需要一个什么平台,才能运行这个Java程序阿? |
N***m 发帖数: 4460 | 13 http://www.oracle.com/technetwork/java/javase/downloads/index.h
get JDK. Install it.
write java file using any editor.
to compile it, use javac yourfile.java
to run it. use java yourfile
【在 f*******r 的大作中提到】 : 兄台,我想问一下,这个Java程序, 是不是就是像我的C++程序一样,在一个编译器里 : 面(我用Visual C++ Experss),编译了,然后直接运行就行了。 : 还是需要一个什么平台,才能运行这个Java程序阿?
|
f*******r 发帖数: 901 | |
N***m 发帖数: 4460 | 15 不谢。
【在 f*******r 的大作中提到】 : 兄台,太感谢了。真及时雨也!
|
S*********g 发帖数: 5298 | 16 C#最简单。有现成webbrowser用,做他这个project,10分钟应该就差不多了。
【在 N***m 的大作中提到】 : http://www.oracle.com/technetwork/java/javase/downloads/index.h : get JDK. Install it. : write java file using any editor. : to compile it, use javac yourfile.java : to run it. use java yourfile
|
f*******r 发帖数: 901 | 17 能否也请SuperString兄台展开讲一讲,我想多学习一下。谢谢! |
g*****g 发帖数: 34805 | 18 With a sign-in page, there's definitely session management
and cookie sent back and forth. Simple URL handling is not
good enough.
There are tools like Rational XDE Tester, LoadRunner that can
do html recording. Probably the right tool for your background
but not free.
Experienced java developer can consider leveraging HtmlUnit,
a headless browser. It takes a couple of hours to handle a
2 page task like this. |
f*******r 发帖数: 901 | 19 请问goodbug兄台,你是说即时有经验的Jave编成高手,也要好几个小时来编写这么一
个程序吗? |
S*********g 发帖数: 5298 | 20 In C#, use free visual studio express
login:
HtmlElementCollection elements = webBrowser1.Document.GetElementsByTagName("
input");
foreach (HtmlElement element in elements)
if (element.Name == "password") //look for the password field
{
element.SetAttribute("value", mypassword); //set the password
foreach (HtmlElement form in webBrowser1.Document.Forms) //look for the
form
if (form.Name == "login")
{
form.InvokeMember("submit"); //submit the form
return;
}
}
【在 g*****g 的大作中提到】 : With a sign-in page, there's definitely session management : and cookie sent back and forth. Simple URL handling is not : good enough. : There are tools like Rational XDE Tester, LoadRunner that can : do html recording. Probably the right tool for your background : but not free. : Experienced java developer can consider leveraging HtmlUnit, : a headless browser. It takes a couple of hours to handle a : 2 page task like this.
|
|
|
c**t 发帖数: 2744 | 21 curl is good enough: sign-in, submit form, grab output(html)
【在 g*****g 的大作中提到】 : With a sign-in page, there's definitely session management : and cookie sent back and forth. Simple URL handling is not : good enough. : There are tools like Rational XDE Tester, LoadRunner that can : do html recording. Probably the right tool for your background : but not free. : Experienced java developer can consider leveraging HtmlUnit, : a headless browser. It takes a couple of hours to handle a : 2 page task like this.
|
f*******r 发帖数: 901 | 22 刚才去HtmlUnit的网页上看了,好像不错。 |
f*******r 发帖数: 901 | |
g*****g 发帖数: 34805 | 24 It may or may not be good enough. Many web app run small javascript
around the submit button, and cUrl will have problem with that.
I do agree when it's enough, it's a simple solution.
【在 c**t 的大作中提到】 : curl is good enough: sign-in, submit form, grab output(html)
|
g*****g 发帖数: 34805 | 25 1,2个小时并非很多时间,这个东西是这样,写个两页的要几个小时,
三页的也许多5分钟就够了。
【在 f*******r 的大作中提到】 : 请问goodbug兄台,你是说即时有经验的Jave编成高手,也要好几个小时来编写这么一 : 个程序吗?
|
l*******G 发帖数: 1191 | 26 this one does not require password, anyone show how to automatically grab
data from here?
http://www.nefsc.noaa.gov/epd/ocean/MainPage/ioos.html
i.e. first automatically select the "trawl survery data" and then
choose the multiple species ascii data, and then
cycle through all years and species and grab the data from the results of the submit?
How does curl deal with a pull down form? |
g*****g 发帖数: 34805 | 27 curl manipulates your http request, so long as you know how to
construct the request (GET/POST), it will work.
the submit?
【在 l*******G 的大作中提到】 : this one does not require password, anyone show how to automatically grab : data from here? : http://www.nefsc.noaa.gov/epd/ocean/MainPage/ioos.html : i.e. first automatically select the "trawl survery data" and then : choose the multiple species ascii data, and then : cycle through all years and species and grab the data from the results of the submit? : How does curl deal with a pull down form?
|
m***i 发帖数: 2480 | 28 webdriver
【在 c**t 的大作中提到】 : curl is good enough: sign-in, submit form, grab output(html)
|
k***e 发帖数: 7933 | 29 找个程序员,你没法搞定的。 如果有login的话,难度很大,可能要处理cookie之类的。
【在 f*******r 的大作中提到】 : 兄台谢谢了。 : 这个网站要输入用户名和密码,还要点好多才能进入。因为保密的原因我就不再这里贴 : url了,请Natom谅解阿。 : 兄台,能否指点一下,用什么语言?程序编成了,怎么编译,怎么运行呢?
|