Sign in to follow this  
Followers 0
Zedna API

1 post in this topic

#1 ·  Posted (edited)

Odorik is Czech VOIP provider

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

Specification of API (in Czech) is here

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 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 = '' & $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
1 person likes this

Share this post

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
Sign in to follow this  
Followers 0