Gelmiş geçmiş en büyük porno sitemiz olan 2pe de her zaman en kaliteli pornoları sunmayı hedefledik. Diğer video sitemiz olan vuam da ise hd porno ağırlıklı çalışmalara başladık.

  1. #1
    Sencha User
    Join Date
    Dec 2011
    Posts
    3
    Vote Rating
    0
    cbroughton is on a distinguished road

      0  

    Default Answered: Can't get ExtJS REST proxy to POST

    Answered: Can't get ExtJS REST proxy to POST


    I'm using this ExtJS REST proxy to get and post data to my REST back end


    HTML Code:
    this.eventStore =Ext.create('Extensible.calendar.data.EventStore',{
        autoLoad:true,
        proxy:{
            type:'rest',
            url:'http://www.notmyrealdomain/testapp/index.php/api/events',
            format:'json',
            noCache:false,
    
            reader:{
                type:'json',
                root:'data'
            },
    
            writer:{
                type:'json',
                nameProperty:'mapping'
            }            
        }
    }
    When I do a print_r on the PHP receiving end it looks like $_POST is empty

    HTML Code:
    print_r($_POST)
    array()
    When I look at Firebug I see that my API page does have JSON being posted to it but the response is just the empty $_POST array.I have checked my config.php BASE_URL and it is my full url http://www.notmyrealdomain.com/testappand I'm pretty sure my proxy above is posting to that url, it's not returning 404 and it doesn't look like it would be cross domain or anything.Does anyone have any suggestions? I've been looking at this for 8 hours now and need some new eyes.

  2. It's in the post body as json, not in the post query args.

    http://stackoverflow.com/questions/6...703326#6703326

    use:
    Code:
    $form_data = json_decode(file_get_contents('php://input'));
    also, don't forget to use the code tag (like html with square brackets) when posting code.

  3. #2
    Ext JS Premium Member dogomatic's Avatar
    Join Date
    Aug 2007
    Location
    Canada
    Posts
    111
    Answers
    2
    Vote Rating
    1
    dogomatic is on a distinguished road

      0  

    Default


    It's in the post body as json, not in the post query args.

    http://stackoverflow.com/questions/6...703326#6703326

    use:
    Code:
    $form_data = json_decode(file_get_contents('php://input'));
    also, don't forget to use the code tag (like html with square brackets) when posting code.

  4. #3
    Ext JS Premium Member tvanzoelen's Avatar
    Join Date
    Apr 2008
    Location
    Groningen - Netherlands
    Posts
    1,111
    Answers
    83
    Vote Rating
    30
    tvanzoelen has a spectacular aura about tvanzoelen has a spectacular aura about tvanzoelen has a spectacular aura about

      0  

    Default


    Are you sure your proxy is posting and not getting?

    In the case it is getting. Set actionMethods on your proxy

    like
    Code:
    actionMethods:  {create: "POST", read: "POST", update: "PUT", destroy: "DELETE"}
    in the default setting read is a GET.

  5. #4
    Sencha User
    Join Date
    Dec 2011
    Posts
    3
    Vote Rating
    0
    cbroughton is on a distinguished road

      0  

    Default


    Quote Originally Posted by dogomatic View Post
    It's in the post body as json, not in the post query args.

    http://stackoverflow.com/questions/6...703326#6703326

    use:
    Code:
    $form_data = json_decode(file_get_contents('php://input'));
    also, don't forget to use the code tag (like html with square brackets) when posting code.
    That's it!
    That explains why firebug didn't look quite right.
    Thank you.

    Is that normal behaviour in REST APIs? And is it pointed out in the Sencha docs? I don't recall seeing anything like that.

  6. #5
    Ext JS Premium Member dogomatic's Avatar
    Join Date
    Aug 2007
    Location
    Canada
    Posts
    111
    Answers
    2
    Vote Rating
    1
    dogomatic is on a distinguished road

      0  

    Default


    Nice!

    It is normal if you're posting json. Query args have to be of the form key=value, so how would you represent a json object with nested objects and arrays? It's hacky but possible to do with some sort of dot notation, but much more sensible to use the post body.

    I don't know if it's in the docs, but I've seen this question asked a few times.

    Maybe make a post in the doc bugs thread:
    http://www.sencha.com/forum/showthre...n-Content-Bugs

    Also, it's partly php's fault for making the post body so obscure.

  7. #6
    Sencha User
    Join Date
    Nov 2008
    Posts
    16
    Vote Rating
    0
    gbs1230 is on a distinguished road

      0  

    Default Thanks. helpful

    Thanks. helpful


    Thanks , helpful

    Quote Originally Posted by tvanzoelen View Post
    Are you sure your proxy is posting and not getting?

    In the case it is getting. Set actionMethods on your proxy

    like
    Code:
    actionMethods:  {create: "POST", read: "POST", update: "PUT", destroy: "DELETE"}
    in the default setting read is a GET.

Thread Participants: 3

Tags for this Thread