Real Software Forums
http://forums.realsoftware.com/

What code to use when posting data to a website?
http://forums.realsoftware.com/viewtopic.php?f=2&t=45257
Page 1 of 1

Author:  Eclipse [ Wed Sep 05, 2012 5:36 am ]
Post subject:  What code to use when posting data to a website?

In my software I will have users registered on a website.
Users shall update their own data as well as automatic data will be updated on the server.

Here is my idea of how it will be done:

1. Use IsConnected to check is the user is online.

2. Use either POST data or to send a form data.

Dim http As New HTTPSocket
http.Get("www.myDomain.com/updateData.asp?USER=123&PASSWORD=123&FiddleData=123", 30)


Or the form...

Dim form As Dictionary
Dim socket1 As New HTTPSocket

// create and populate the form object
form = New Dictionary
form.Value("USER") = "123"
form.Value("PASSWORD") = "123"
form.Value("FIDDLEDATA") = "123"

// setup the socket to POST the form
socket1.SetFormData(form)
socket1.Post("http://www.myformlocation.com/form.asp")


My question here is, how would you do it...??
When writing this post, I think the second choice looks better.... and I will try that alternative. However, I need to prepare the server for these things!!

Author:  Eclipse [ Wed Sep 05, 2012 9:03 am ]
Post subject:  Re: What code to use when posting data to a website?

Dim n as NetworkInterface

//Get the NetworkInterface object for the selected item
'n = System.GetNetworkInterface(Me.listIndex)
n = System.GetNetworkInterface

//Get the MAC Address
Window1.MacAddressField.Text = n.MACAddress
//Get the IP Address
Window1.IPAddressField.Text = n.IPAddress
//Get the Subnet Mask
Window1.SubnetMaskField.Text = n.SubnetMask


This is from the Reference Guide and the MAC Address isn't working... I know, it's a network question, but I was thinking of separating users using the MAC Address... So, to put all relevant code belonging to the same issue it's might possible to ask here...(??)

I put this code in app.open and IP + SubNet is working, not MAC! Silly and annoying...
What am I missing???

***
EDIT:
me.text = System.GetNetworkInterface.MACAddress
me.text = System.GetNetworkInterface(0).MACAddress

These two alternatives, to an empty textField, doesn't work as well... ??? Why is that!?
I use the latest copy of REALbasic, 2012 r something.

Author:  pony [ Wed Sep 05, 2012 9:26 am ]
Post subject:  Re: What code to use when posting data to a website?

This works for me RB2012 R1, Mac:
Dim n as NetworkInterface
Dim i as Integer
Dim mString as string

For i = 0 to System.NetworkInterfaceCount-1
n = System.GetNetworkInterface(i)
mString = mString + "Network interface number "+Str(i)+" has the MAC address "+ n.MACAddress +EndOfLine
Next

msgbox mString

Author:  Eclipse [ Wed Sep 05, 2012 9:45 am ]
Post subject:  Re: What code to use when posting data to a website?

me.text = System.GetNetworkInterface(1).MACAddress


Shouldn't be zero, should be one!!
Then it's working! Thank you!!

***
But then again, is that different from different computers!? I'm using broadband network, which is USB in my laptop...
Maybe the zero is for the network card, the Ethernet kind...

So... if I'm using the MAC Address to detect a computer, maybe this person connect to Internet using LAN at work and mobile broadband on the road and then will end up with different MAC Addresses...!?

I never thought of that...
Well, I'll leave that for now.

Author:  Carharttguy [ Thu Sep 06, 2012 1:25 pm ]
Post subject:  Re: What code to use when posting data to a website?

MAC-adresses are unique to each networkdevice. Theoretically.

Never forget that MAC spoofing is very easy, so don't be sure that every record will be different.

Author:  Eclipse [ Wed Sep 12, 2012 9:34 am ]
Post subject:  Re: What code to use when posting data to a website?

I understand and see the limit.

Everything running http is reasonable insecure.
I'd prefer https... even if it also has it lack of trust. But much more work to break.

Using MAC was a way to try to differ a user from another in a logging function.
If I have two computers with the same broadband I think it will show as the same MAC.

It's not so important. It can still be little useful. However, to bear in mind the limit.

When its working, I'd love to have code in a RB project speak to server. Neat!!

Author:  Eclipse [ Wed Sep 12, 2012 9:50 am ]
Post subject:  Re: What code to use when posting data to a website?

Works beautiful!!
Data inserted in database!!

Only one problem... When submitting data (ie "Push here to publish") the RB program freeze...
It seems as there is a time-out that never expire!?
What's the deal!?

I use the FORM code, posted above.

Author:  Eclipse [ Thu Sep 13, 2012 5:21 am ]
Post subject:  Re: What code to use when posting data to a website?

Taken from the documentation.
Quote:
HTTPSocket.Post ( URL as String, TimeOut as Integer ) As String

How is that done in code!?
Quote:
socket1.Post("http://www.domain.com/dev/insert.asp") <-- working
socket1.Post("http://www.domain.com/dev/insert.asp", 5) <-- not working
socket1.Post("http://www.domain.com/dev/insert.asp", 5) as String <-- not working

Author:  Eclipse [ Thu Sep 13, 2012 9:36 am ]
Post subject:  Re: What code to use when posting data to a website?

Quote:
1. 2012-09-12 16:45:38 ... 00:1E:10:1F:AA:49

2. 2012-09-13 01:36:50 ... 00:1E:10:1F:1F:81

3. 2012-09-13 08:39:13 ... 00:1E:10:1F:82:A0

4. 2012-09-13 16:32:12 ... 00:1E:10:1F:2C:0E


Here is another interesting thing... I get different MAC Addresses each time I connect! As you can see, the first four parts are similar, but there is a different end each time.

It makes MAC Address even more insecure!! Even if it's only one user/ computer on a hidden URL and knowing it's me, it's not safe at all!!

Author:  Carharttguy [ Fri Sep 14, 2012 8:41 am ]
Post subject:  Re: What code to use when posting data to a website?

Eclipse wrote:
Quote:
1. 2012-09-12 16:45:38 ... 00:1E:10:1F:AA:49

2. 2012-09-13 01:36:50 ... 00:1E:10:1F:1F:81

3. 2012-09-13 08:39:13 ... 00:1E:10:1F:82:A0

4. 2012-09-13 16:32:12 ... 00:1E:10:1F:2C:0E


Here is another interesting thing... I get different MAC Addresses each time I connect! As you can see, the first four parts are similar, but there is a different end each time.

It makes MAC Address even more insecure!! Even if it's only one user/ computer on a hidden URL and knowing it's me, it's not safe at all!!



This is not normal, every networkcard has its own MAC adress, so, I guess this is a bug in RS?

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/