I have found a sample Slim Api script that works fone when I run it on localhost - however when I upload API script to my website and try calling from localhost - I get the following error:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://phoenixsoftware.co.nz/SocialProject/api/updates?_=1464554029519. (Reason: CORS header 'Access-Control-Allow-Origin' does not match '*, *').
I have updated the index.php API script to have a header as follows: header("Access-Control-Allow-Origin: *");
Also the .htaccess is as follows: RewriteEngine On
# Some hosts may require you to use the `RewriteBase` directive.
# If you need to use the `RewriteBase` directive, it should be the
# absolute physical path to the directory that contains this htaccess file.
#
# RewriteBase /
Header add Access-Control-Allow-Origin "*"
Header add Access-Control-Allow-Headers "origin, x-requested-with, content-type"
Header add Access-Control-Allow-Methods "PUT, GET, POST, DELETE, OPTIONS"
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]