We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOther Libraries › Problem httpclient and phtml
Page Index Toggle Pages: 1
Problem httpclient and phtml (Read 451 times)
Problem httpclient and phtml
Jan 20th, 2009, 1:35pm
 
Hello, i'm french student in art school and totally noob in programming Smiley, but i want to do my best.
My problem is : i used the httpclient in network library and i saved the html source in a .txt file. It work when i use a simple website. But i want to save the html source of this website http://www.boursorama.com/cours.phtml?symbole=CLMR09 to create an interactive animation with flash. But when i run the program, it send me this error :
java.net.UnknownHostException:
http://www.boursorama.com/cours.phtml?symbole=CLMR09
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at processing.net.Client.<init>(Client.java:60)
at HTTPClient.setup(HTTPClient.java:36)
at processing.core.PApplet.handleDraw(PApplet.java:1383)
at processing.core.PApplet.run(PApplet.java:1311)
at java.lang.Thread.run(Unknown Source)
java.lang.NullPointerException
at processing.net.Client.write(Client.java:442)
at processing.net.Client.write(Client.java:468)
at HTTPClient.setup(HTTPClient.java:37)
at processing.core.PApplet.handleDraw(PApplet.java:1383)
at processing.core.PApplet.run(PApplet.java:1311)
at java.lang.Thread.run(Unknown Source)
java.lang.NullPointerException
at processing.net.Client.write(Client.java:442)
at processing.net.Client.write(Client.java:468)
at HTTPClient.setup(HTTPClient.java:38)
at processing.core.PApplet.handleDraw(PApplet.java:1383)
at processing.core.PApplet.run(PApplet.java:1311)
at java.lang.Thread.run(Unknown Source)
Is it possible to save a source from a phtml ?
PS: It works with internet explorer but i can't use it because i want to refresh the source all the 10 seconds and rewrite it in a .txt file so flash use it in dynamic text.
Re: Problem httpclient and phtml
Reply #1 - Jan 20th, 2009, 1:41pm
 
Salut.

I think you cannot use processing.net.Client to get a Web page. The constructor expects a host, which is at best http://www.boursorama.com and have nothing to handle a full URL, even less GET parameters (the part after ?).

You can use an HTML (or XML if page is XHTML compliant) library to get it, I think.
Re: Problem httpclient and phtml
Reply #2 - Jan 20th, 2009, 4:29pm
 
Is this what you are after?

String lines[] = loadStrings(
 "http://www.boursorama.com/cours.phtml?symbole=CLMR09"
 );
saveStrings("fluidforms2.html", lines);
Page Index Toggle Pages: 1