This period of time want to do a Web Capture program, because a website uses anti-collection method, my httpclient always after login can't get to I want the past link. After countless traces found that the original people to return is a JavaScript page, and contains the frameset, during the nesting of a lot of frame. Because HttpClient's getresonsebody can only get the server side and cannot further parse and execute it. During the time to try to further the return of the JS Code simulation browser execution, but, suddenly think of PHP's Curl module is very powerful, it can be directly taken back. So just wondering if it would be easy to try curl?
Installing Curl
Java code
- Yum Install Curl Curl-devle
Download Java Bindings for Libcurl
http://curl.haxx.se/libcurl/java/
Configuring and Compiling Java-libcurl
Java code
- Gunzip curl-java-0.2. 2.tar.gz
- Tar xvf curl-java-0.2. 2.tar
- CD curl-java-0.2. 2
- Make
Note that the corresponding Javacurl library files are generated under Linux and some Java class source files that need to be used. However, note that the paths in makefile are configured in the directory you installed when you are translating.
Under Windows to compile into DLL files. In the eclipse environment, place the DLL file in windows/system32 or rewrite the header file according to your directory standard, and then perform the compilation. Otherwise, the Java.lang.UnsatisfiedLinkError error will be given.
For this error, we can see the powerful Jer discussion, post in:
http://www.iteye.com/topic/58461?page=2
Because, in the source file in Libcurl-java, there are
Java code
- try {
- //Loading up the shared JNI
- System.loadlibrary ("Javacurl");
- } catch (Exception e) {
- E.printstacktrace ();
- }
The packages that have been compiled in the relevant Windows environment are:
http://www.gknw.de/mirror/curl/curl_java/
Then, execute the Test.java file in the curl-java-0.2.2 package (you can change the URL inside to the stubborn website you want to log into)
Did you see that it was thoughtful of you to return what you wanted?
If you're using Ruby,python or Perl, just install their Libcurl binding module and take a dip in your world.
http://lovejuan1314.iteye.com/blog/290461
Have a strong curl, forget the httpclient!