Hi I'm trying to get data from an api that ONLY returns JSON rather than JSONP. Every time I try to get the data connecting as JSONP it doesn't work because I am not expecting JSON. So, I guess I have to use a PHP proxy to get past the cross-domain issue so I can interpret the JSON request. [Simple PHP Proxy][1] is one that I'm trying to use but I am having a hell of a time trying to get the most basic functionality to work. When I type the url I want to query into his example on the example page, it works. When I do it, it doesn't, sometimes I get a "Missing Command" (the API's way of telling me that there are too many or too little arguements) or a httpcode/jsoncode 404.
Expensify is the API I am querying. I am first trying the Authenticate command. IF you type this URL in your browser, you get the results I want: https://api.expensify.com?command=Authenticate&partnerName=applicant&partnerPassword=d7c3119c6cdab02d68d9&partnerUserID=expensifytest%40mailinator.com&partnerUserSecret=hire_me
Using the Simple PHP Proxy my request URL turns out to be: http://people.rit.edu/~cjs6948/exp/ba-simple-proxy.php?url=https://api.expensify.com?command=Authenticate&partnerName=applicant&partnerPassword=d7c3119c6cdab02d68d9&partnerUserID=expensifytest%40mailinator.com&partnerUserSecret=hire_me
Here is my very simple jQuery code:
var proxy = 'ba-simple-proxy.php';
url = proxy + '?' + "url=" + "https://api.expensify.com? command=Authenticate&partnerName=applicant&partnerPassword=d7c3119c6cdab02d68d9&partnerUserID=expensifytest%40mailinator.com&partnerUserSecret=hire_me";
$.getJSON( url, function(data){});
"ba-simple-proxy.php" can be found [here][3]. Does anyone have any experience trying to connect to a cross-domain API via a proxy? Maybe even this one? Have any better ideas? Any help is appreciated, thanks.