Title: Havelock Api help needed can get any results Post by: karol on April 11, 2014, 07:47:21 AM 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']))); ?> Title: Re: Havelock Api help needed can get any results Post by: Retired on April 11, 2014, 09:03:00 AM Do you have the json extension installed?
Title: Re: Havelock Api help needed can get any results Post by: karol on April 11, 2014, 09:08:56 AM Yes I have from phpinfo():
json json support enabled json version 1.2.1 Title: Re: Havelock Api help needed can get any results Post by: jparsley on April 11, 2014, 09:46:10 AM Do they provide support
Title: Re: Havelock Api help needed can get any results Post by: karol on April 11, 2014, 10:10:57 AM Yes, but don't belive they will give me answer (not so far), I contacted them as well.
Title: Re: Havelock Api help needed can get any results Post by: Retired on April 28, 2014, 01:59:25 AM 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. |