Echoed Response From Job
Permalink
An observation I have:
I made an http request to a job URL, the returned response appeared to be a JSON string, but the data keys are not enclosed by double quotes, so the PHP function json_decode() fails if applied to this string.
I wrote this work-around line of PHP code to insert the needed quotes into the string before decoding:
[code]
$response = preg_replace('#([a-zA-Z]+): ?#', '"$1":', $response);
[code]
I made an http request to a job URL, the returned response appeared to be a JSON string, but the data keys are not enclosed by double quotes, so the PHP function json_decode() fails if applied to this string.
I wrote this work-around line of PHP code to insert the needed quotes into the string before decoding:
[code]
$response = preg_replace('#([a-zA-Z]+): ?#', '"$1":', $response);
[code]
Ill work on an actual fix tomorrow for this, its pretty simple,
Thanks.
With this working correctly, it will be useful when interacting with a C5 site from another server, so that we can tap into the C5 functionality without having to write standalone tool code to access the database.
With this working correctly, it will be useful when interacting with a C5 site from another server, so that we can tap into the C5 functionality without having to write standalone tool code to access the database.