JSON, URL-encode, and UTF-8

Monte Goulding monte at sweattechnologies.com
Thu Aug 20 19:03:16 EDT 2015


Just before posting can you dump your tData variable into a binfile and send it to me. It's got to be something simple...

Sent from my iPhone

> On 21 Aug 2015, at 8:33 am, J. Landman Gay <jacque at hyperactivesw.com> wrote:
> 
> Thanks, but still no go. I get the same errors.
> 
> Is anyone posting from LC 7? I also just tried 7.1rc1 but it doesn't work either.
> 
>> On 8/20/2015 5:04 PM, Monte Goulding wrote:
>> Is your convertToJSON function returning UTF8? I’m not sure what LC 7 does when it concatenates “json=“ to a UTF8 string. If for example that json= is UTF16 and the rest of the data is UTF8 it’s not surprising the server is freaking out. Try:
>> 
>> put textEncode(“json=“,”UTF8”) before tData
>> 
>>> On 21 Aug 2015, at 7:53 am, J. Landman Gay <jacque at hyperactivesw.com> wrote:
>>> 
>>> I'm still struggling with this. I have a valid JSON string, verified by a web-checking site and by the PHP developer. He wants me to POST it this way:
>>> 
>>> json=<JSON string>
>>> 
>>> It doesn't work. He says the server receives it but it is not passed to the PHP script because the main parameter is empty. Here's what I do:
>>> 
>>>  set the httpHeaders to "content-type: application/json"
>>>  put convertToJSON() into tData -- produces valid JSON
>>>  put "json=" before tData
>>>  post tData to kServerURL
>>> 
>>> The result is empty. The developer has set up the PHP to return the values back to me for testing, but "it" is also always empty. He says this means there is no "main parameter", but he also said adding "json=" to the front would provide that, he will just grab the params from what follows.
>>> 
>>> The URL is https if that matters. I have also tried URLEncoding the JSON but it didn't help. I also tried removing the custom header.
>>> 
>>> He pointed me to this web site: <https://www.hurl.it/> When I set it to send JSON and enter the same params there, it POSTs successfully to the server.
>>> 
>>> How would you POST a JSON string to a PHP script on a secure server?
>>> 
>>> --
>>> Jacqueline Landman Gay         |     jacque at hyperactivesw.com
>>> HyperActive Software           |     http://www.hyperactivesw.com
>>> 
>>> _______________________________________________
>>> use-livecode mailing list
>>> use-livecode at lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
>> 
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> 
> -- 
> Jacqueline Landman Gay         |     jacque at hyperactivesw.com
> HyperActive Software           |     http://www.hyperactivesw.com
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




More information about the use-livecode mailing list