Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

cannot process web form.  RSS feed

 
Adamz Preston
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, when I try to process this form:
http://www.gcontroller.com/CheckComputerID.php

with this code:


It doesn't work, it simply prints out nothing when it should print out if the license exists or if it doesn't

If you want the form utility and the parseHTML files to look at you can find them at
http://www.heatonresearch.com/book/http-programming-java.html
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the "if (ch == 0)" check in the advance method supposed to accomplish? That character wouldn't be found in an HTML page, thus causing that method to read the entire input stream.
 
Adamz Preston
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm very new to HTTP programming so I am not an expert but it says in the Jeff Heaton HTTP programming book that if ch == 0 it means that the specified html tag has been found. I understand your confusion for I had the same problem... However this program uses ch==0 again and works perfectly.




Also I am not sure if you have realised but www.gcontroller.com/CheckComputerID.php is a website I own.

here is the code for the php file:

 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I see. However, that PHP code doesn't seem to produce HTML (or at least not well-formed HTML), and going by the class and method names in your Java code ("parsehtml", gettag") I would expect the code to be geared towards HTML handling. That's just a guess, though, as I'm not familiar with those helper classes.

Maybe the author of that book has a support forum or mailing list where you can get in touch with him (or other readers) directly.
 
Adamz Preston
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
okay I have put <p> and </p> tags in the php code now and changed the java code accordingly but it still won't work. Also figured out that its not the parsing which seems to be the problem, at the moment anyway. But instead the program doesn't seem to be submitting correctly. But anyway yh I will go to the heaton research website and look around for a forum or chatroom. Thanks for your help

EDIT:

Okay they have a forum however it appears to be dead, some threads have been waiting there and not still not been answered although about 6 months have passed. I think its going to be alot quicker to continue getting help off people using this forum. So keep coming with any suggestions
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure what you changed, but if you merely added <p> tags around the result, then it's still not well-formed HTML, since the BODY and HTML tags are already closed by the time the license stuff is printed.
 
Adamz Preston
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yh the <p> tags but it doesn't have to be well formed html it just has to be able to be defined as a html tag by the html parser. However can we focus on what might be going wrong in the submitting of the form. I know this is the current problem because when I downloaded the html page programatically just after the form.complete() function there was no output given on the page.
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could check out the server logs to see what kind of request gets there, assuming that the server does create logs. If it's an Apache then it usually does, or can be configured to log fairly easily.

Also, maybe those utility classes work differently than they appear to work. This code seems to work as intended:
 
Adamz Preston
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks so much! Ill use the html parser on this for now and try and understand the form utility better in the future . If the HTML parser does not work then it doesn't matter because I've done quite a lot of parsing of html without the parser. You can consider this thread closed Thanks again!
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Glad to hear it worked. You can use several parameters by writing

String urlParameters = "param1=foo&param2=bar"
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!