View previous topic :: View next topic |
Author |
Message |
Art
Joined: 09 Nov 2005 Posts: 647
|
Posted: Mon May 03, 2010 5:09 pm Post subject: Minimalist Internet samples |
|
|
Hi Guys,
I asked this in a forum thread discussing PSP LUA, but I shouldn't really limit my inquiry to LUA.
Are there any minimal examples around for doing simple internet stuff?
There's a few things I'd like to try.
These aren't it, but some examples of simple things could include:
1) Retrieving the time from an SNTP time server such as pool.ntp.org
2) Getting your public IP address from an IP server such as checkip.dyndns.com
3) Logging onto a server with username and password and then clicking a button on a web page
???
Well the third example IS actually what I'd like to have an executable program do.
Cheers, Art.
Thankyou _________________ If not actually, then potentially. |
|
Back to top |
|
|
arnie
Joined: 11 Apr 2009 Posts: 16
|
Posted: Mon May 03, 2010 5:45 pm Post subject: |
|
|
You can try looking into InsertWittyName's Phoenix Game Engine. It has some net related material in there.
Checkout the latest svn. ;)
-arnie |
|
Back to top |
|
|
Torch
Joined: 28 May 2008 Posts: 842
|
Posted: Mon May 03, 2010 6:21 pm Post subject: |
|
|
You mean in LUA or natively on the PSP?
Natively is trivial. Google UNIX socket tutorial. It should work without any modification on the PSP. For the web page, I wonder if the sceHTTP* functions allow you to manually set the headers or POST variables. If they do it makes the job easier.
Other wise just use a socket connection and follow this:
http://developers.sun.com/mobility/midp/ttips/HTTPPost/
For logging in, it depends on whether its a form login, or a HTTP authentication username/password prompt. For the former case you will need to send the username/password via POST variables and the latter you will need to use the Authorization: Basic xxxxxxxxx header in the request. The username/password are Base64 encoded or something. For submitting the form/clicking button its again a POST or GET, both of which you can set the variables in the headers or query string.
You can also use libCurl for this. You can easily set the variables etc in the request. |
|
Back to top |
|
|
Art
Joined: 09 Nov 2005 Posts: 647
|
Posted: Mon May 03, 2010 7:49 pm Post subject: |
|
|
No it wouldn't have to be done in LUA,
in fact LUA would only make things more difficult for me.
Just about all of the above does sound very scary to me though,
knowing next to nothing about internet stuff, which I guess is why
I said "minimal".
I guess I'd find it easiest if there was a C program sample that
did one or two of these things and nothing more.
For the server I had in mind, a seperate little window pops up asking for username / password combination.
_________________ If not actually, then potentially. |
|
Back to top |
|
|
Jim
Joined: 02 Jul 2005 Posts: 487 Location: Sydney
|
Posted: Mon May 03, 2010 8:28 pm Post subject: |
|
|
Basic Auth:
Set the header 'Authorization' equal to 'Basic' + space + base64encode(username + ':' + password)
Jim _________________ http://www.dbfinteractive.com |
|
Back to top |
|
|
Torch
Joined: 28 May 2008 Posts: 842
|
Posted: Mon May 03, 2010 10:04 pm Post subject: |
|
|
This is a good resource for minimal HTTP communication: http://www.tutorialspoint.com/http/index.htm
Just open a socket connection just like in any UNIX TCP socket example. Print the HTTP commands, and read the result.
(Don't get confused by the part where it says HTTP is connectionless and the client must disconnect and wait for the server. Just open a connection, write the HTTP request, and read from the same connection.) |
|
Back to top |
|
|
Art
Joined: 09 Nov 2005 Posts: 647
|
Posted: Tue May 04, 2010 4:31 am Post subject: |
|
|
Ok, I'll take a look, thanks. _________________ If not actually, then potentially. |
|
Back to top |
|
|
|