json_decode Issue

Discussion in 'Installation/Configuration' started by parkerj, May 11, 2015.

  1. parkerj

    parkerj Member

    Below is my current configuration:
    Ubuntu 14.04.2 LTS

    I am having issues with json_decode, and I am not sure where the issue lies, so I am hoping that someone here can help me.

    In the system that I am using, I have the following code:
    $json _file_get_contents($json_url 'staff/staffID/' $id '/');
    $decode json_decode($jsontrue);
    When running this code on an Apache server, it returns results if the ID exists. On my Nginx/ISPConfig3 powered server, the same code returns NULL? I figured that there was something missing in the vhost, so I created a custom vhost master and added the following to location @php {}: default_type application/octet-stream;. I did a resync in ISPConfg3, checked the vhost of the site, saw that it was updated, but I am still getting a NULL result when I do var_dump($decode) even though the staffID exists.

    Is there something I am missing?
  2. parkerj

    parkerj Member

    I figured it out. The issue was having a number in the base url for $json_url (i.e. http://example.com/v1/staff/staffID/1/). I don't know why having "v1" in the url would cause issue on Nginx / ISPConfig3 but it does. Versioning an API is common practice.

Share This Page