Send Data PHP

Home Forums Puzzles Send Data PHP

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #21492
    Avatarchaac
    Newbie

    I have a question..
    i want send data with “Send Data” Puzzle to PHP File. But they dont have any request.. no Data sent? The $_POST array was empty..
    Where is the mistake.. i don’t know :scratch:

    But here my simple Test (Result -> int(0)):

    Attachments:
    You must be logged in to view attached files.
    #21495
    Yuri KovelenovYuri Kovelenov
    Developer

    Hi,

    if you try to send something really simple such as a piece of text, will the server receive it?

    3D Verger, the CEO
    LinkedIn | FB | Twitter | VK | 新浪微博

    #21496
    Avatarchaac
    Newbie

    like this .. no :-(

    Attachments:
    You must be logged in to view attached files.
    #21498
    Yuri KovelenovYuri Kovelenov
    Developer

    is the Verge3D app launched from the same domain/port as the PHP server?

    3D Verger, the CEO
    LinkedIn | FB | Twitter | VK | 新浪微博

    #21499
    Avatarchaac
    Newbie

    yes, localhost:80 (xampp-server)

    #21503
    Yuri KovelenovYuri Kovelenov
    Developer

    where is your php script located? can you launch it via browser address bar?

    3D Verger, the CEO
    LinkedIn | FB | Twitter | VK | 新浪微博

    #21577
    Avatarchaac
    Newbie

    yes, all in the same folder on Webserver “http://localhost/verge3d/test.php”.
    I make a Test .. switch POST to GET:
    <?php var_dump(count($_GET)); ?>
    Call WB: http://localhost/verge3d/test.php?test=true
    Resuld: int(1) It’s running :yes:
    I also get a feedback about the 3d scene.. only no POST is transmitted. :unsure:

    #21589
    Yuri KovelenovYuri Kovelenov
    Developer

    I’m no PHP expert, but there might be situations when you cannot read POST contents.
    BTW, can you also check if the piece of the JavaScript code behind the send data puzzle (can be seen in the visual_logic.js) works in your setup?

    3D Verger, the CEO
    LinkedIn | FB | Twitter | VK | 新浪微博

    #21602
    Avatarchaac
    Newbie

    It’s all visible:

    this.procedures[“dophp”] = dophp;
    ..
    function dophp(VAR) {
    console.log(VAR);
    }
    ..
    oActivObj = null;
    registerOnClick(aAllEditableObj, function() {
    objDict = getObjCustomProps(_pGlob.pickedObject);
    if (dictGet(objDict, ‘activ’) == false) {
    outline(aAllEditableObj, ‘DISABLE’);
    oActivObj = _pGlob.pickedObject;
    outline(oActivObj, ‘ENABLE’);
    dictSet(objDict, ‘activ’, true);
    } else {
    outline(oActivObj, ‘DISABLE’);
    dictSet(objDict, ‘activ’, false);
    oActivObj = null;
    }
    sendData(objDict, ‘test.php’, function() {
    dophp(_pGlob.loadedFile);
    });
    }, function() {});

    .. it all works HTML-Elements control 3d-Scene and vice versa.
    In the same html run a $.ajax POST (2 Objects to test.php).. it work’s perfectly. Only the “send data” Puzzle .. send NO data.. no String, no Number, no Object .. nothing.

    #21605
    Avatarchaac
    Newbie

    ok, i have the solution!! :yahoo:
    The function sendData() send the request Header as Content-type ‘application/json’, and strings as ‘text/plain’. Anyway.. the $_POST Array ist always empty!
    On PHP we must decode the file content as json.. that’s all ;-)

    Result are an full Array!
    Maybe should mention that at “send data” in the help.

    #21614
    Yuri KovelenovYuri Kovelenov
    Developer

    glad you worked it out! :good:

    3D Verger, the CEO
    LinkedIn | FB | Twitter | VK | 新浪微博

Viewing 11 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic.