Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Sun Aug 19, 2018 4:52 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 13 posts ] 
Author Message
 Post subject: HTTP Socket
PostPosted: Mon Nov 19, 2012 8:07 pm 
Offline

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
 Profile  
Reply with quote  
 Post subject: Re: HTTP Socket
PostPosted: Mon Nov 19, 2012 8:17 pm 
Offline
User avatar

Joined: Sun Aug 05, 2007 10:46 am
Posts: 4931
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
iMac I7[2012], OSX Mountain Lion 10.8.3 RB2012r2.1
Note : I am not interested in any solutions that involve custom Plug-ins of any kind


Top
 Profile  
Reply with quote  
 Post subject: Re: HTTP Socket
PostPosted: Mon Nov 19, 2012 8:32 pm 
Offline

Joined: Mon May 31, 2010 5:35 am
Posts: 2412
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") = "some@email.address"
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
 Profile  
Reply with quote  
 Post subject: Re: HTTP Socket
PostPosted: Mon Nov 19, 2012 8:53 pm 
Offline

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") = "some@email.address"
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
 Profile  
Reply with quote  
 Post subject: Re: HTTP Socket
PostPosted: Mon Nov 19, 2012 8:54 pm 
Offline

Joined: Mon May 31, 2010 5:35 am
Posts: 2412
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") = "some@email.address"
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
 Profile  
Reply with quote  
 Post subject: Re: HTTP Socket
PostPosted: Mon Nov 19, 2012 8:55 pm 
Offline

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") = "some@email.address"
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
 Profile  
Reply with quote  
 Post subject: Re: HTTP Socket
PostPosted: Mon Nov 19, 2012 8:57 pm 
Offline
User avatar

Joined: Mon Apr 02, 2007 2:08 am
Posts: 1225
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
 Profile  
Reply with quote  
 Post subject: Re: HTTP Socket
PostPosted: Mon Nov 19, 2012 9:03 pm 
Offline

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
 Profile  
Reply with quote  
 Post subject: Re: HTTP Socket
PostPosted: Mon Nov 19, 2012 9:08 pm 
Offline

Joined: Mon May 31, 2010 5:35 am
Posts: 2412
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
 Profile  
Reply with quote  
 Post subject: Re: HTTP Socket
PostPosted: Mon Nov 19, 2012 9:12 pm 
Offline

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
 Profile  
Reply with quote  
 Post subject: Re: HTTP Socket
PostPosted: Mon Nov 19, 2012 9:17 pm 
Offline

Joined: Mon May 31, 2010 5:35 am
Posts: 2412
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
 Profile  
Reply with quote  
 Post subject: Re: HTTP Socket
PostPosted: Mon Nov 19, 2012 9:26 pm 
Offline

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
 Profile  
Reply with quote  
 Post subject: Re: HTTP Socket
PostPosted: Mon Nov 19, 2012 9:30 pm 
Offline

Joined: Mon May 31, 2010 5:35 am
Posts: 2412
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
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group