$apikey, 'signature' => $sign, 'nonce' => $nonce ); $post_data = http_build_query($postdata, '', '&'); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); //curl_setopt($ch, CURLOPT_SSLVERSION, 1 /*CURL_SSLVERSION_TLSv1*/); curl_setopt($ch, CURLOPT_SSL_SESSIONID_CACHE, 0); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; Bitstamp API PHP client; '.php_uname('s').'; PHP/'.phpversion().')'); curl_setopt($ch, CURLOPT_ENCODING , ''); $execResult = curl_exec($ch); $res = json_decode($execResult, true); return $res; } // https://www.bitstamp.net/api/v2/ticker/btceur/ function bitstamp_btceur() { $ticker = bitstamp_api_query('ticker', 'btceur'); return is_array($ticker) ? floatval($ticker["last"]) : false; } function bitstamp_btcusd() { $ticker = bitstamp_api_query('ticker', 'btcusd'); return is_array($ticker) ? floatval($ticker["last"]) : false; }