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 / Difference in HTTP code between windows and iOS/Mac

Author
Message
JohnnyMeek
11
Years of Service
User Offline
Joined: 23rd Apr 2013
Location: Slovenia
Posted: 15th Oct 2015 15:24
I have some http code that sends PUT commands via some PHP code that works on PC but not on iOS or Mac.

I've logged the url to a file in my PHP at the start to show what data is coming in from the URL and it doesn't even connect on Mac or iOS if there are spaces or quotes in the URL. I literally had to encode quotes as an asterisk and then convert all asterisks back to quotes in the PHP code to get it to work. It's very strange.

So for this code:


the adin function puts quotes around the string. In this format the string doesn't send, but if I change the adin function to add '*' in place of quotes the url will send to my PHP code.
JohnnyMeek
11
Years of Service
User Offline
Joined: 23rd Apr 2013
Location: Slovenia
Posted: 3rd Nov 2015 07:59
This is still giving me issues.

It appears that the characters are not being escaped properly on iOS/Mac. I've had to make the php code jump through hoops to get this working. It would be awesome if we could get better http commands, maybe adding in a curl library. It would certainly make it easier to interface with 3rd party solutions.

Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 3rd Nov 2015 15:42
iOS and Mac are a lot more strict about the URLs they will accept, you should URL Encode anything that is a special character. In this case use %20 for space, %27 for single quotes and %22 for double quotes. PHP should automatically convert them back to the proper values, if not you can use the PHP function urldecode on any parameters that are still encoded. AppGameKit also includes the commands HTTPEncode and HTTPDecode that do the same thing.
JohnnyMeek
11
Years of Service
User Offline
Joined: 23rd Apr 2013
Location: Slovenia
Posted: 4th Nov 2015 07:33
Thanks, that helps a lot.

It might be a good idea to move those commands out of the misc. section of the help and put them with the other HTTP help commands. I didn't even know they existed.

Login to post a reply

Server time is: 2024-09-29 07:25:24
Your offset time is: 2024-09-29 07:25:24