Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

[HELP] How to login to a website and get XML data of that site

 
Gynnad Paullussen
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I'm trying to login to a website, named Maxithlon.com, to get xml data from that site. So I can make a program for the users. The only problem is, I can't get the connection.

This is the login string query: http://www.maxithlon.com/maxi-xml/login.php?user=Gynnad&scode=1q2w3e4r
Where Gynnad is the username and 1q2w3e4r is the securitycode.

First I thought it was a POST-method but it isn't, so this code isn't right, but is what i had:



and this was the result of that code:



Can someone help me with a explanation/tutorial or something?

Thanks!
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the login works via GET, why are you trying to use POST? Do you have any indication that that should work?
 
Rob Spoor
Sheriff
Pie
Posts: 20667
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The page apparently doesn't accept POST requests; it does accept GET requests. Just put the parameters in the URL:

Usually I'd suggest to not post read passwords, but in this case we wouldn't be able to test any solutions without it. I do suggest you to change it as soon as possible after finding a proper solution though.
 
Gynnad Paullussen
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Spoor wrote:The page apparently doesn't accept POST requests; it does accept GET requests. Just put the parameters in the URL:

Usually I'd suggest to not post read passwords, but in this case we wouldn't be able to test any solutions without it. I do suggest you to change it as soon as possible after finding a proper solution though.




Now it works to login, now i'm going to set some cookies so I can go to another website and get the content of that page. I will post that also here. If you have some comments please give them so I can learn about it!

The password is not the real password of the page, it is a securitycode and you can only access the pages with the xml, not the game.
 
Campbell Ritchie
Sheriff
Pie
Posts: 50225
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

That question looks too difficult for us here on "beginning"; shall move it. Not sure whether to "servlets" in view of POST and GET, maybe I'll try "in general" and let Rob move it again if he thinks appropriate.
 
Rob Spoor
Sheriff
Pie
Posts: 20667
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nah, it's good here. But you could also have considered Sockets and Internet Protocols
 
Gynnad Paullussen
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Now I have this, with this output:


So I understand this page has 2 cookies, but witch one should I use and how can I go now to another webpage?
 
Gynnad Paullussen
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Ok, with the second cookie the connection works! So now I will make the code a bit clearer and only use the 2th cookie. Someone has any tips for me?
 
Gynnad Paullussen
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I now see if the user is sign in? Because the website returns always a Cookie. So I can't check if the cookie is null.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic