Bitcoin Forum
May 26, 2024, 08:37:34 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Havelock Api help needed can get any results  (Read 659 times)
karol (OP)
Full Member
***
Offline Offline

Activity: 150
Merit: 100


View Profile
April 11, 2014, 07:47:21 AM
 #1

Hi Guys,

I was starting to use havelock investments API based on Havelock Investments example.
I try to use their example (code below) but don't get any results.
I have instaled curl to php, generally script is working as I add dummy line and can see it.
Any help?

<?php
$key="pasted key here";
$ch=curl_init();
$url="https://www.havelockinvestments.com/api/index.php";

curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);

function api($cmd,$vars=array()) {
    global $ch;
    global $url;
    global $key;
    curl_setopt($ch,CURLOPT_URL, $url);
    $fields=array("key"=>$key,
            "cmd"=>$cmd);
    $fields_string="";
    $fields=array_merge($fields,$vars);
    foreach($fields as $k=>$value) { $fields_string .= $k.'='.urlencode($value).'&'; }

    $fields_string=rtrim($fields_string, '&');
    curl_setopt($ch,CURLOPT_POST, count($fields));
    curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);

    $ret=curl_exec($ch);

print_r("dummy "); //----added for testing and it is visible so server is working

    return json_decode($ret,true);

}

phpinfo();
print_r(api("ticker"));
print_r(api("tickerfull",array("symbol"=>"HIF")));

print_r(api("balance"));
print_r(api("portfolio"));
print_r(api("orderbook",array("symbol"=>"HIF")));

$o=api("ordercreate",array("symbol"=>"HIF", "action"=>"buy", "price"=>0.1, "units"=>10));
print_r($o);

print_r(api("ordercancel",array("id"=>$o['order'])));

?>
Retired
Sr. Member
****
Offline Offline

Activity: 490
Merit: 250


View Profile WWW
April 11, 2014, 09:03:00 AM
 #2

Do you have the json extension installed?
karol (OP)
Full Member
***
Offline Offline

Activity: 150
Merit: 100


View Profile
April 11, 2014, 09:08:56 AM
 #3

Yes I have from phpinfo():

json

json support   enabled
json version   1.2.1
jparsley
Sr. Member
****
Offline Offline

Activity: 266
Merit: 250



View Profile
April 11, 2014, 09:46:10 AM
 #4

Do they provide support

please unban me.
karol (OP)
Full Member
***
Offline Offline

Activity: 150
Merit: 100


View Profile
April 11, 2014, 10:10:57 AM
 #5

Yes, but don't belive they will give me answer (not so far), I contacted them as well.
Retired
Sr. Member
****
Offline Offline

Activity: 490
Merit: 250


View Profile WWW
April 28, 2014, 01:59:25 AM
 #6

Yes, but don't belive they will give me answer (not so far), I contacted them as well.
Have you received a reply? It's been a few weeks already.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!