New topic: HTTP Socket
<http://forums.realsoftware.com/viewtopic.php?t=45989> Page 1 of 1 [ 13 posts ] Previous topic | Next topic Author Message wrangly Post subject: HTTP SocketPosted: Mon Nov 19, 2012 8:07 pm Joined: Mon Mar 05, 2007 9:31 pm Posts: 9 I want to get the source code of a website that require username and password. The website is "http://www.erepublik.com/gr/economy/exchange-market/" I use: Function AuthenticationRequired(Realm As String, Headers As InternetHeaders, ByRef Name As String, ByRef Password As String) As Boolean name = "my user name" Password= "my password" End Function I only get the source code of the login page... Thank you... Top DaveS Post subject: Re: HTTP SocketPosted: Mon Nov 19, 2012 8:17 pm Joined: Sun Aug 05, 2007 10:46 am Posts: 4271 Location: San Diego, CA You can't do it that way...... I have an AppleScript that will go to a URL and type in the username and password http://forums.realsoftware.com/viewtopic.php?f=1&t=45805&hilit=+autosend this is also info there for windows... but I haven't tried it yet. _________________ Dave Sisemore MacPro, OSX Lion 10.7.4 RB2012r1 Note : I am not interested in any solutions that involve custom Plug-ins of any kind Top swort Post subject: Re: HTTP SocketPosted: Mon Nov 19, 2012 8:32 pm Joined: Mon May 31, 2010 5:35 am Posts: 2255 Location: Netherlands Do this: make a subclass of an httpsocket, call it myHttpSocket then add a property to your window and call it http As myhttpsocket Dim d As new Dictionary d.value("citizen_email") = "[email protected]" d.value("citizen_password") = "some_password" http.SetFormData(d) http.post("http://www.erepublik.com/en/login") CHANGE THE VALUES TO YOUR EMAIL AND PASSWORD TO TEST... SEE THE myHTTPSocket.PageReceived event for the output. _________________ SWORT⢠- Windows Vista, Windows XP, Windows 7, Linux Mint 11 and Mac OSX Lion - REAL Studio Enterprise(latest) and WEB Edition(latest) - Plugins (MBS Complete, ToringoLib, Einhugur, VanHoek + Some open source plugins) For Dutch User Groups ask me to enter! Top wrangly Post subject: Re: HTTP SocketPosted: Mon Nov 19, 2012 8:53 pm Joined: Mon Mar 05, 2007 9:31 pm Posts: 9 swort wrote:Do this: make a subclass of an httpsocket, call it myHttpSocket then add a property to your window and call it http As myhttpsocket Dim d As new Dictionary d.value("citizen_email") = "[email protected]" d.value("citizen_password") = "some_password" http.SetFormData(d) http.post("http://www.erepublik.com/en/login") CHANGE THE VALUES TO YOUR EMAIL AND PASSWORD TO TEST... SEE THE myHTTPSocket.PageReceived event for the output. I got "NilObjectException" at http.SetFormData(d)... Top swort Post subject: Re: HTTP SocketPosted: Mon Nov 19, 2012 8:54 pm Joined: Mon May 31, 2010 5:35 am Posts: 2255 Location: Netherlands wrangly wrote:swort wrote:Do this: make a subclass of an httpsocket, call it myHttpSocket then add a property to your window and call it http As myhttpsocket Dim d As new Dictionary d.value("citizen_email") = "[email protected]" d.value("citizen_password") = "some_password" http.SetFormData(d) http.post("http://www.erepublik.com/en/login") CHANGE THE VALUES TO YOUR EMAIL AND PASSWORD TO TEST... SEE THE myHTTPSocket.PageReceived event for the output. I got "NilObjectException" at http.SetFormData(d)... did you add the http As myhttpsocket to your window as a property? _________________ SWORT⢠- Windows Vista, Windows XP, Windows 7, Linux Mint 11 and Mac OSX Lion - REAL Studio Enterprise(latest) and WEB Edition(latest) - Plugins (MBS Complete, ToringoLib, Einhugur, VanHoek + Some open source plugins) For Dutch User Groups ask me to enter! Top wrangly Post subject: Re: HTTP SocketPosted: Mon Nov 19, 2012 8:55 pm Joined: Mon Mar 05, 2007 9:31 pm Posts: 9 swort wrote:wrangly wrote:swort wrote:Do this: make a subclass of an httpsocket, call it myHttpSocket then add a property to your window and call it http As myhttpsocket Dim d As new Dictionary d.value("citizen_email") = "[email protected]" d.value("citizen_password") = "some_password" http.SetFormData(d) http.post("http://www.erepublik.com/en/login") CHANGE THE VALUES TO YOUR EMAIL AND PASSWORD TO TEST... SEE THE myHTTPSocket.PageReceived event for the output. I got "NilObjectException" at http.SetFormData(d)... did you add the http As myhttpsocket to your window as a property? Yes i did... Top charonn0 Post subject: Re: HTTP SocketPosted: Mon Nov 19, 2012 8:57 pm Joined: Mon Apr 02, 2007 2:08 am Posts: 1017 Location: San Francisco, CA, USA wrangly wrote:swort wrote: did you add the http As myhttpsocket to your window as a property? Yes i did... The code uses the name http but the socket property is named myhttpsocket. myhttpsocket.SetFormData(d) myhttpsocket.post("http://www.erepublik.com/en/login") _________________ Boredom Software Top wrangly Post subject: Re: HTTP SocketPosted: Mon Nov 19, 2012 9:03 pm Joined: Mon Mar 05, 2007 9:31 pm Posts: 9 ok fixed... But where i must enter the internal url to get its source code (www.erepublik.com/gr/economy/exchange-market/)? Top swort Post subject: Re: HTTP SocketPosted: Mon Nov 19, 2012 9:08 pm Joined: Mon May 31, 2010 5:35 am Posts: 2255 Location: Netherlands wrangly wrote:ok fixed... But where i must enter the internal url to get its source code (http://www.erepublik.com/gr/economy/exchange-market/)? You don't. Fist you logon wit my code above. If that worked, you must do a new GET request to move to wher you want. But i think you need a cookie or a param to return a session identifier. Eg the site must know that you are logged in. Try looking into the source an all headers of that site to find what you need _________________ SWORT⢠- Windows Vista, Windows XP, Windows 7, Linux Mint 11 and Mac OSX Lion - REAL Studio Enterprise(latest) and WEB Edition(latest) - Plugins (MBS Complete, ToringoLib, Einhugur, VanHoek + Some open source plugins) For Dutch User Groups ask me to enter! Top wrangly Post subject: Re: HTTP SocketPosted: Mon Nov 19, 2012 9:12 pm Joined: Mon Mar 05, 2007 9:31 pm Posts: 9 swort wrote:wrangly wrote:ok fixed... But where i must enter the internal url to get its source code (http://www.erepublik.com/gr/economy/exchange-market/)? You don't. Fist you logon wit my code above. If that worked, you must do a new GET request to move to wher you want. But i think you need a cookie or a param to return a session identifier. Eg the site must know that you are logged in. Try looking into the source an all headers of that site to find what you need You are right. The code gives me the source of the login page... Thank you anyway! Top swort Post subject: Re: HTTP SocketPosted: Mon Nov 19, 2012 9:17 pm Joined: Mon May 31, 2010 5:35 am Posts: 2255 Location: Netherlands wrangly wrote:swort wrote:wrangly wrote:ok fixed... But where i must enter the internal url to get its source code (http://www.erepublik.com/gr/economy/exchange-market/)? You don't. Fist you logon wit my code above. If that worked, you must do a new GET request to move to wher you want. But i think you need a cookie or a param to return a session identifier. Eg the site must know that you are logged in. Try looking into the source an all headers of that site to find what you need You are right. The code gives me the source of the login page... Thank you anyway! Login page, but do you get logged in? _________________ SWORT⢠- Windows Vista, Windows XP, Windows 7, Linux Mint 11 and Mac OSX Lion - REAL Studio Enterprise(latest) and WEB Edition(latest) - Plugins (MBS Complete, ToringoLib, Einhugur, VanHoek + Some open source plugins) For Dutch User Groups ask me to enter! Top wrangly Post subject: Re: HTTP SocketPosted: Mon Nov 19, 2012 9:26 pm Joined: Mon Mar 05, 2007 9:31 pm Posts: 9 I have a textarea to display source code. In myhttpsocket: Sub PageReceived(url as string, httpStatus as integer, headers as internetHeaders, content as string) textarea1.text=url textarea2.text=content End Sub the url is http://www.erepublik.com/en/login When i succesfully login from browser it takes me to "http://www.erepublik.com/en/". Top swort Post subject: Re: HTTP SocketPosted: Mon Nov 19, 2012 9:30 pm Joined: Mon May 31, 2010 5:35 am Posts: 2255 Location: Netherlands wrangly wrote:I have a textarea to display source code. In myhttpsocket: Sub PageReceived(url as string, httpStatus as integer, headers as internetHeaders, content as string) textarea1.text=url textarea2.text=content End Sub the url is http://www.erepublik.com/en/login When i succesfully login from browser it takes me to "http://www.erepublik.com/en/". Ok if it logged you in with success, then you need to see if there is a cookie read the documentatio of HTTPSocket to find info how to get it. Otherwise aaak here if it doesnt work. _________________ SWORT⢠- Windows Vista, Windows XP, Windows 7, Linux Mint 11 and Mac OSX Lion - REAL Studio Enterprise(latest) and WEB Edition(latest) - Plugins (MBS Complete, ToringoLib, Einhugur, VanHoek + Some open source plugins) For Dutch User Groups ask me to enter! Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 13 posts ]
-- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
