Advertisement

ShellExecute for Linux

Started by December 15, 2003 08:25 AM
12 comments, last by Turt99 20 years, 10 months ago
If you are just interested in sending the score to a game server (via HTTP/CGI or PHP?), and not display web content, I think it is better to do it "in-process". You could do this fairly trivially just using socket functions, but using a HTTP library (like libcurl?) might be better.

If all you need is to send a HTTP request, and don''t care about displaying the response, there is no need to invoke a browser at all.
quote: Original post by CWizard
If you are just interested in sending the score to a game server (via HTTP/CGI or PHP?), and not display web content, I think it is better to do it "in-process". You could do this fairly trivially just using socket functions, but using a HTTP library (like libcurl?) might be better.

If all you need is to send a HTTP request, and don''t care about displaying the response, there is no need to invoke a browser at all.


I''ve never used sockets before so I''ll do a little research, if you have any links that would be helpfull please post them..
Just one question do I need to do anything special with the webserver to handle the requests? I''m not hosting the site on my computer so I''m wonder if this would be something I''d need admin access to set up..

FOLLOW ME ON TWITTER OR MY BLOG
Advertisement
quote: Original post by Turt99
I've never used sockets before so I'll do a little research, if you have any links that would be helpfull please post them..
They wouldn't be hard to find, but if you haven't used them before, it's probably not the best reason to start. However, here's one: Beej's Guide to Network Programming
quote: Just one question do I need to do anything special with the webserver to handle the requests? I'm not hosting the site on my computer so I'm wonder if this would be something I'd need admin access to set up..
I don't know how you have it setup now, but probably, no. Assuming you have a HTML "form" it is trivial to do the equivalent programmatically; you just do the same thing as the web browser do. It could be as simple as sending this request to the server:

GET /cgi-bin/submit-score.cgi?player-name=CWizard&score_code=c67556ae54d09e5209beddeacc45b9ef HTTP/1.1
Host: www.your-domain.tld

(you can do the same thing with a telnet client)

Or, if the script needs it to be POSTed, it is a bit more complicated:

POST /cgi-bin/submit-score.cgi? HTTP/1.1
Host: www.your-domain.tld
Content-Type: multipart/form-data; boundary=-----------------------------3866236621304
Content-Length: 200

-----------------------------3866236621304
Content-Disposition: form-data; name="player-name"

CWizard
-----------------------------3866236621304
Content-Disposition: form-data; name="score_code"

c67556ae54d09e5209beddeacc45b9ef
-----------------------------3866236621304

(something like that; I think it's correct)

However, a HTTP library should provide an easy interface to all this.

[edited by - CWizard on December 15, 2003 6:21:19 PM]
Do not use the flag HTTP/1.1 without a complete HTTP library.

Use HTTP/1.0 instead.

This topic is closed to new replies.

Advertisement