Quantcast
Channel: Appcelerator Developer Center Q&A Tag Feed (403)
Viewing all articles
Browse latest Browse all 2

HTTPClient returns 403 error from my App only

$
0
0

Hi

In an iOS 6 app, I make a HTTPClient call very much like the doc advises. On the url side I generate some JSON like this

...
header('Content-type: application/json');
echo json_encode($post);
It works from any browser window but returns a 403 error on my App. The strangest part is it was working perfectly for a few weeks before it suddenly dropped.

Here's my code:

function callDetails(){
 
     var url = "myurl.com/mycall.php?myvars";
     var client = Ti.Network.createHTTPClient({
         // function called when the response data is available
         onload : function(e) {
            alert("Success: Received text: " + this.responseText);
         },
         // function called when an error occurs, including a timeout
         onerror : function(e) {
             alert("error="+ e.error + " - status=" +this.status +" - responseText="+this.responseText);
         },
         timeout : 5000  // in milliseconds
     });
     // Prepare the connection.
     client.open("GET", url);
     // Send the request.
     client.send();
I would like to use this as an API.

Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images