Track Topic
: rss

Topic: account/login/LoginAction.do

posts 1–7 of 7
Page 1
?
70 posts

Hi,

Does anyone have any experience of calling account/login/LoginAction.do via https post?

Seems I can do it in java using HttpClient, but when I try in javascript through an XMLHttpRequest object I get a responeText containing 'You are not authorised to perform this action.'

Any thoughts appreciated.

Cheers,
Mike.

?
70 posts

Ignore me, cookies were disabled in the browser ... sorted now. :)

?
91 posts

I'm curious, how are you managing to use javascript to login?

I mucked around a while back logging into the api using javascript on a private webpage. Due to browser security (cross domain checking) I could only do it by using adding the greasemonkey extension to firefox and using its GM_xmlhttpRequest function.

?
128 posts
Mike, as a fellow scraper (in VB6), i'm wondering if you can share some simple Java code? I'm interested in Java but lack the motivation to learn it because
a) my VB6 bots work perfectly and are very easy to maintain and update
b) i tried to do some scraping with Java but failed

I can get the HTML via java.net.URL and set the headers using the .setRequestProperty. The main problems i encountered were session handling (cookies need to be auto-handled like WinHTTP.dll) and also i failed to work out how to decompress the gZipped responses after i had set the relevent request header. I know that i can request none-compressed data but i like to do things properly and therefore gZip compression is essential.

As a last resort, i could always use Vb.Net. Yell
?
70 posts

fred,

ahh yes, cross domain checking ... funny how that one caught me out ...

I've been teaching myself web app technology recently (mainly been java 'fat client' or server process developer in the past) and didn't read about the cross domain security at first.
And to begin with I was testing my html/javascript by loading it directly into the browser from the local file system (ie file:///Users/blah rather than html://localhostblah) ... which seems to allow you to then use XMLHttpRequest to call any domain you like.

So of course I wrote a whole bunch of stuff directly calling the various betfair .do scripts. Lovely.

Then I took the next step so I could get a bit more sophisticated and write my own servlets. I installed glassfish and bundled my web app and deployed it.
Then when I tested the same stuff from http:/localhost:8080/myWebApp it stopped working!!!!!

Took me a while to figure out what was going on and was pretty p1ssed off when I realised, thinking I'd wasted all my time!

However as a workaround what I've done is write a few servlets of my own which act as a proxy to betfair. So i can call https://localhost:8080/myWebApp/account/loginAction.do for example.

Not as big a pain as it sounds as the proxy servlet is very simple, but it obviously adds an extra couple of network hops into the equation so won't be using it for critical apps!

Must admit I'm quite enjoying dabbling with webapp development. You can get some quite nifty stuff running quickly using AJAX techniques.

Ok, I'm in a generous mood so I'll drop a couple of useful links in:

http://www.prototypejs.org
http://https://glassfish.dev.java.net

?
70 posts

brichy,

You don't want to be using java.net.URL, you want to be using HttpClient.
See http://hc.apache.org/httpclient-3.x

The tutorial on there should get you going. (http://hc.apache.org/httpclient-3.x/tutorial.html)
It's really simple and cookies are auto handled by default I think.

As for decompressing gziped stuff, take a look at class java.util.zip.GZIPInputStream

?
91 posts

Thanks Mike. I was just curious, I'm not actively pursuing a javascript solution now, it was just something I was looking at the other year as an unusual bot programming language that anybody could use (everybody has a web browser and text editor) without having to download/configure/workaround anything.

posts 1–7 of 7
Page 1

This Topic Is Locked To Guest Posts

It's been a while since this topic was active, if you'd like to get it going again, please post as a registered member

join now