Jump to content

Recommended Posts

Odorik is Czech VOIP provider http://www.odorik.cz/?jazyk=en

with very good prices and they provide API for using some services through HTTP protocol.

Specification of API (in Czech) is here http://www.odorik.cz/w/api

I created Autoit's UDF for using it:

For better readability I removed all error checking.

Script was tested and all works fine, name/password/telephone/link are changed to illustrative ones.

Names of some variables and texts translated from Czech to English.

$name = '123456'
$passw = 'password'

$output = OdorikHttpCommand('GET', '/balance', '', $name, $passw)
ConsoleWrite('balance: ' & $output & @CRLF)

$output = OdorikHttpCommand('GET', '/lines', '', $name, $passw)
ConsoleWrite('lines: ' & $output & @CRLF)

$output = OdorikHttpCommand('GET', '/sms/allowed_sender', '', $name, $passw)
ConsoleWrite('sms-allowed_sender: ' & $output & @CRLF)

$output = OdorikHttpCommand('POST', '/callback', 'caller=602123456&recipient=602123456&line=123456', $name, $passw)
ConsoleWrite('callback: ' & $output & @CRLF)

$text = StringReplace('Testing SMS message through Odorik.cz API', ' ', '%20')
$output = OdorikHttpCommand('POST', '/sms', 'sender=00420602123456&recipient=00420602123456&message=' & $text, $name, $passw)
ConsoleWrite('sms: ' & $output & @CRLF)
If Not StringInStr($output, 'successfully') Then ConsoleWrite("SMS message couldn't be sent. Reason: " & $output & @CRLF)

Func OdorikHttpCommand($type, $command, $param = '', $name = '', $passw = '')
    $url = 'https://www.odorik.cz/api/v1/' & $command
    $url &= "?user=" & $name & "&password=" & $passw & "&user_agent=Autoit"
    If $param <> '' Then $url &= '&' & $param

    $oXmlHttp = ObjCreate("Microsoft.XMLHTTP")
    $oXmlHttp.Open($type, $url, False)
    Return $oXmlHttp.ResponseText

Here is link to topic on Odorik forum where I posted this:


Edited by Zedna
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...