API Code Samples for Delphi

Do you have API Code samples for Delphi? Now I'm still using PHP to execute API calls from Delphi.

Comments

  • Hello. There are not samples, at least over the forum. You just need to implement a websocket client. then implement the API checking API guide.

    maybeyou can use this library.

    https://github.com/andremussche/DelphiWebsockets

    Regards

  • Hi adhisakti did you integrate binary API in PHP. Please share some sample code

  • edited July 2016

    @tarja said:
    Hello. There are not samples, at least over the forum. You just need to implement a websocket client. then implement the API checking API guide.

    maybeyou can use this library.

    https://github.com/andremussche/DelphiWebsockets

    Regards

    I've tried that, but it's so complicated and still won't connect with Binary API server.

    @trade4mebinarydemo said:
    Hi adhisakti did you integrate binary API in PHP. Please share some sample code

    I'm using the same code from the samples page and change it a little bit. Save as ws.html and open in browser, in address bar type : ws.html?market=type your market here, i.e. for Volatility 100 Index : ws.html?market=R_100

    <html>
    <head>
    </head>
    <body id="messages">
        <script>
            function getQuery(name) {
                if(name=(new RegExp('[?&]'+encodeURIComponent(name)+'=([^&]*)')).exec(location.search))
                    return decodeURIComponent(name[1]);
            }
    
            window.onload = function() {
                var messagesList = document.getElementById('messages');
                var socket = new WebSocket('wss://ws.binaryws.com/websockets/v3');
                socket.onopen = function(event) {
                    socket.send('{"ticks": "'+getQuery("market")+'"}');
                };
                socket.onmessage = function(event) {
                    var message = event.data;
                    messagesList.innerHTML += message;
                };
                window.onbeforeunload = function() {
                    socket.close();
                };
            };
        </script>
    </body>
    </html>
    
  • @adhisakti Hi thanks, this is in javascript. I need it in PHP script. Do you have any idea?

Sign In or Register to comment.