Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


  • 0

Php script from virtual device


KristianO

Question

How to call a php script On My local webserver using a virtul device wo LUA?

I try to add the ip:port together with a GET of the Php script but nothing happens.

Pasting all in one URL in the browser and it works just fine.

Please help!

Link to comment
Share on other sites

Recommended Posts

  • 0

KristianO, 3 options to do what you need:

1. Use non-lua virtual device

GET /page.php HTTP/1.1

2. Use LUA

Please login or register to see this code.

3. Use my LUA Toolkit (

Please login or register to see this link.

) if you need extended possibilities as for example : custom headers and others...

Please login or register to see this image.

/emoticons/default_icon_smile.gif" alt=":-)" />

Link to comment
Share on other sites

  • 0
  • Inquirer
  • Thanks alot!

    1. When to add

    - HTTP/1.1

    - HTTP/1.10x0D0x0A0x0D0x0A

    - or just nothing

    Link to comment
    Share on other sites

    • 0

    add 0x0D0x0A0x0D0x0A if you add custom header or body in your request

    Please login or register to see this image.

    /emoticons/default_icon_wink.gif" alt=";-)" />

    ex:

    Please login or register to see this code.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Trying to set-up the virtual device but can’t get it to work.

    The same URL in the browser works just fine. "http://10.0.1.10:xxxx/sonos/sonos.php?message=Coming_home&volume=30&force_unmute=1"

    - > It plays the text in the Sonos speaker

    But creating the Virtual device with the same IP and PORT and with following GET request and nothing happens. I tried with/without the response checkbox.

    "GET /sonos/sonos.php?message=Coming_home&volume=30&force_unmute=1 HTTP/1.1"

    Any idea?

    Link to comment
    Share on other sites

    • 0

    KristianO, for sonos tts you can play directly in lua with my code here:

    Please login or register to see this link.

    or you should use Net.FHttp with LUA to call your php script

    Please login or register to see this image.

    /emoticons/default_icon_wink.gif" alt=";-)" />

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Yes but since i got a hcl i dont have LUA. Thats why i want to Call My php code. Please help

    Link to comment
    Share on other sites

    • 0

    Please login or register to see this code.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • A.Socha I tried that too, but its not working. I now even deleted the device and re-created it wo success.

    Link to comment
    Share on other sites

    • 0

    Oh

    Please login or register to see this image.

    /emoticons/default_icon_rolleyes.gif" alt=":roll:" />

    As you say in your title: "... From scene" but you can't make http request from a scene. You must make a button in a virtual device and call it from your scene, is this what you do?

    Work for me.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Sorry, i used the wrong head line. Its a virtual device thats not working.

    IP/Port assigned.

    Using the same in an URL as above it works just fine.

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

    • 0

    KristianO, what option you got chosen ? wait for response you got on "on" or on "off"

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • I have tried both... None works

    Since i supose that when i push the button, it should call the script?

    Link to comment
    Share on other sites

    • 0

    tested just and it working here you got my example

    and on target device i get

    ~ $nc -l -p 12345

    Please login or register to see this code.

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Thanks! But what can i do to check why its not working for me? A step by step guidance whould be appriciated.

    Since its still works using the URL from browser

    Link to comment
    Share on other sites

    • 0

    login on that server and check what you get on port 80

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Can the problem be that i use port 8888 for my webserver?

    Link to comment
    Share on other sites

    • 0
    Can the problem be that i use port 8888 for my webserver?
    No, i think you can use the port you want

    Please login or register to see this image.

    /emoticons/default_icon_wink.gif" alt=";-)" />

    Download Fiddler

    Please login or register to see this link.

    and compose your request with it. Fiddler might help you to debug the response of your server...

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • The Call is made and no response is made, can That be The problem? That The vd requeries a response? I just want to Call The request and let The text speak in My sonos.

    Link to comment
    Share on other sites

    • 0

    that server got linux? if yes change port to some free like 8889 and use command

    nc -l -p 8889

    then when you gonna press button you should saw that get what you was send if that will work check with 8888 maybe you need credentials

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Yes its My local MAMP server running osx.

    The Apache server is set to port 8888.

    How to Apply the credentials?

    I'm sorry but I'm still learning.

    [ Added: 2014-03-21, 09:43 ]

    I have now tried both,

    GET sonos/sonos.php?message=Coming_home&volume=30&force_unmute=1 HTTP/1.1

    Host: 10.0.1.10

    Authorization: Basic (Base64 usr:pwd string)

    0x0D0x0A0x0D0x0A

    and a more "simple" direct TTS

    POST /MediaRenderer/AVTransport/Control HTTP/1.1

    Content-Length: 439

    SOAPACTION: "urn:schemas-upnp-org:service:AVTransport:1#SetAVTransportURI"

    0,x-rincon-mp3radio://translate.google.com/translate_tts?tl=en&q=There+is+someone+at+the+door,0x0D0x0A0x0D0x0A

    None of them works... Im starting to think that my HCL can't connect in my LAN.

    Any simple test to test that?

    Link to comment
    Share on other sites

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Answer this question...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

    ×
    ×
    • Create New...