Send Data out of krpano

  • Hi

    I am working on a project where you can choose items and I wan't to send the list/data of those items to an other device to check/edit this data. There you would read this Data and Display it on a Website (html form?).

    Now i could write the Data somehow to a Database or another way would be a PHP Post Request.
    Problem there is that i understand krpano xml quite good, but not so much of PHP and/or Databases.

    Has anyone already this something like this? Which way should i go?
    How could I do a POST Request over a krpano onclick action?

    Thanks for your fast answers
    Sven

  • This isn't as hard as you think, but you will have to make sure the exposed back-end is safe and sane in PHP. The interface could look something like this :


    On the PHP side, you have a number of options, but it is important to make sure that it is secure because this interface is exposed to the world. There are plenty examples on how to do this properly, but essentially, you have to make sure that the PHP script isn't able to access and read/write in places where it shouldn't.

    DBIO.php can be build to both read and write from a database. In case of a non-null value and no ID, you could make it insert, With an ID and a value, do an update and with a ID and a null value, do a select.

    For returning data, you could simply return a string and parse it in JS. I tend to generate XML and return that for parsing, but that is a personal preference.


    A basic setup would look something like this. You can find most code snippets you need easily online.

    You can make this as simple or complex as you like, but the important part is the security of the interface. I'd advice to follow these instruction for the DBIO : https://phpdelusions.net/pdo

    Edited 4 times, last by Timescale (April 23, 2017 at 3:54 PM).

  • Hi Timescale

    Thanks for your post. I am trying to understand how this works.
    Important for me is, that I don't need to go out the VR mode.

    Our actual solution works with opening an URL that has all the information stored in it.
    Then the PHP reads out the Data and sends an Email with all the Data to the Customers that then can work with it.

    So can I make this request without leaving the KRpano VR mode?

    Thanks
    Sven

  • hi

    i just included jquery and then it's really simple!

    Code
    $.ajax({ url: yoururl, async: false});




    I had to set "async: false" as otherwise it's not working on chrome for android.


    Sven

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!