Updated PHP script to return JSON encoded values