Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / HTML5 - GET, POST and COOKIES

Author
Message
Jambo B
14
Years of Service
User Offline
Joined: 17th Sep 2009
Location: The Pit
Posted: 16th Apr 2017 14:10
Hi all,

Is it possible for an AppGameKit app running in the browser to access variables provided in GET or POST requests, or to set/retrieve cookies?

If not, this would be very useful!

Thanks!

James
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 16th Apr 2017 17:21
can you give a example of use?
AGK (Steam) V2017.03.31 : Windows 10 Pro 64 Bit : AMD (17.2.1) Radeon R7 265 : Mac mini OS Sierra (10.12.2)
Jambo B
14
Years of Service
User Offline
Joined: 17th Sep 2009
Location: The Pit
Posted: 16th Apr 2017 17:35
As an example, let's say you had an app which needed a username and password at the start. Could we pre-fill the username using a GET request, e.g.:

https://example.com/agkprog.html?username=Bob

The user could create a shortcut to the site which looked like the above.

In AppGameKit, could I have access to the variable passed?

By the way, I know that using it like this would be ill-advised and lessen the security of the app - it's just an example

Thanks,

James
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 16th Apr 2017 19:28
oha

AGK (Steam) V2017.03.31 : Windows 10 Pro 64 Bit : AMD (17.2.1) Radeon R7 265 : Mac mini OS Sierra (10.12.2)
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 17th Apr 2017 00:40 Edited at: 17th Apr 2017 00:41
off the top of my head, grab the AppGameKit output container page and edit it to be php, add the $_GET and write it to file, make the AppGameKit app read the file and fill the input field, could work, no?
Jambo B
14
Years of Service
User Offline
Joined: 17th Sep 2009
Location: The Pit
Posted: 17th Apr 2017 19:45
@PartTimeCoder - good thought! I tried your suggestion, and couldn't seem to get AppGameKit to read any directories on the server in HTML5. I'll try a few other bits and bobs though. Thanks for the idea.

If anyone has any other suggestions, please let me know.

James
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 18th Apr 2017 05:41
Not sure why your app would need to read GET and POST data, are you trying to write a server in agk? You can write that data out in the http request, but a response would never include such data in that way unless it was sending its own request to your app. In which case I don't know what you'd be pushing to the app.

If you have the requested url, you could parse out the GET variables from the string.

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
Jambo B
14
Years of Service
User Offline
Joined: 17th Sep 2009
Location: The Pit
Posted: 18th Apr 2017 11:18
Hi Phaelax,

Thanks for the reply. I'm not trying to write a server in AGK. I have a series of php files and a backend database which do all the server stuff. What I'd like to do is have the user be able to create a shortcut on their desktop, e.g. to https://example.com/agkprog.html?username=Bob which would automatically fill in some of the login details. But not the password, obviously.

Does anyone know of any way for AppGameKit running in HTML5 to access files other files held in its own directory?

Cheers all,

James
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 18th Apr 2017 12:55
Quote: "Does anyone know of any way for AppGameKit running in HTML5 to access files other files held in its own directory?"

It's sandboxed, so can't.
Signature removed by mod because it's larger than 600x120... please resize and try again.
Digital Awakening
AGK Developer
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 20th Apr 2017 14:05
I think AppGameKit can access files through the HTML commands while in HTML5 mode. Not sure if you can use relative paths or if you have to use specific URLs. I think you can use GET and/or POST when accessing files.

Login to post a reply

Server time is: 2024-05-19 03:23:14
Your offset time is: 2024-05-19 03:23:14