facebook

Problem to access PHP script from web application

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #348572 Reply

    lemorlenny
    Member

    Hi,
    I have an app that read records from a mysql remote table through Ajax javascript and .PHP applications.
    I have some problems to receive data from my remote .PHP application.
    It work well when compiled and installed as .apk on Android device but not when tested in Web simulator or deployed as Web application on Mobione web space neither on my web server, in debug I see some “Failed to load resource: net::ERR_FAILED” referred to my .PHP remote applications, but calling the link manually its working, and in the compiled app its working too.

    some more significative error:

    ***********
    Error derived from external iframed asp page, ignore it
    Refused to set unsafe header “Content-length” ShowItems.asp:1
    Refused to set unsafe header “connection” ShowItems.asp:1
    ***********

    GET http://www.mysite.it/app/my-remote.php?par1=&par2=&par3=&par4= net::ERR_FAILED ripple.js:121859

    Surely its my bad but I can’t figure where the problems born.

    Regards.

    #348608 Reply

    lemorlenny
    Member

    I believe mine its a Cross-Domain problems, I’m looking to understand CORS procedures.

    #348636 Reply

    Hi lemorlenny,

    I consulted to the dev team if it is a cors issue and they agreed that it is the most probably issue. This example should be helpful for you: Load Data File Cross Domain

    #348640 Reply

    lemorlenny
    Member

    @support-octavio wrote:

    Hi lemorlenny,

    I consulted to the dev team if it is a cors issue and they agreed that it is the most probably issue. This example should be helpful for you: Load Data File Cross Domain

    After waste 1 day I discover that my Windows ISP server doesn’t implement the PHP’s CURL library, so I’m migrating on Linux server to restart the test.
    I tried to search the sample you cited but I haven’t found.

    Regards

    #348652 Reply
    #348657 Reply

    lemorlenny
    Member

    @support-octavio wrote:

    Hi lemorlenny,

    This is the doc’s url: http://www.genuitec.com/support-genuitec/viewtopic.php?f=14&t=2846

    Hi, I finally made a step forward, I spent some time using GET without success but when , hopeless, i tried to use POST everything began to work. I don’t know why, perhaps the data to receive are too long.

    JS:

    
      if (window.XMLHttpRequest) {
        // code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp = new XMLHttpRequest();
        xmlhttp.withCredentials = "true";
      }
      else {
        // code for IE5 and IE6
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        xmlhttp.withCredentials = "true";
      }
    
      xmlhttp.onreadystatechange = function(){
    
        if (xmlhttp.readyState == 4 && xmlhttp.status == 200 ) {
          var Result = xmlhttp.responseText;
    
          alert(Result);
        }
      }
    
      var queryString = "?id=&cat=&reg=&pro=&"; //+"?t=" + Math.random();
      
      xmlhttp.open("POST", url + queryString,true);
      
      xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      
      xmlhttp.send(null);
    

    I had tried to insert in the PHP code:

    
    header("Access-Control-Allow-Origin: *");
    

    but nothing change, the GET doesn’t work anyway and the POST appear not need any specific header to to work.

    Now my problem is this:

    
      $('#m1-Search-adImage').attr('src', aDataBannerLocal[0]);  // bannerurl
    

    I use an array filled with some ads URL images that I show randomly at bottom of the pages.
    Sample:aDataBannerLocal[0]=”http://www.externalserver.com/bannerad/banner3.jpg”
    Again I receive the same previous error:
    GET http://www.externalserver.com/bannerad/banner3.jpg net::ERR_FAILED jquery-1.8.3.min.js:2
    This time I haven’t control to this calling so I can’t manage it trough the code.

    How can I modify the image loading in other mode?

    Best regards

    PS.
    I was unable to insert some other PHP code sample because the forum engine report an error:

    Method Not Implemented
    POST to /support-genuitec/posting.php not supported.

    #348792 Reply

    lemorlenny
    Member

    how delete wrong post?

    #348914 Reply

    Hi lemorlenny,

    I don’t think it is possible for users delete their own posts. I can move/split/merge a topic if you think it is necesary, just let me know the url.

Viewing 8 posts - 1 through 8 (of 8 total)
Reply To: Problem to access PHP script from web application

You must be logged in to post in the forum log in