我想要连接到 localbitcoins 的 wampserver 上出现卷曲错误
curl error on my wampserver that wanna connect to localbitcoins
您好,我使用 wamp 服务器和 apache:2.4.9 php:5.5.12 上的版本
我尝试将 curl 与此代码一起使用:
<?php
function localbitcoins_query($path, array $req = Array()) {
$key='MY_KEY';
$secret='MY_SECRET';
$mt = explode(' ', microtime());
$nonce = $mt[1].substr($mt[0], 2, 6);
if ($req) {
$get=httpbuildquery($req);
$path=$path.'?'.$get;
}
$postdata=$nonce.$key.$path;
$sign = strtoupper(hash_hmac('sha256', $postdata, $secret));
$headers = array(
'Apiauth-Signature:'.$sign,
'Apiauth-Key:'.$key,
'Apiauth-Nonce:'.$nonce
);
$ch = null;
$ch = curl_init('https://localbitcoins.com'.$path);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 20);
$res = curl_exec($ch);
if ($res === false) throw new Exception('Curl error: '.curlerror($ch));
$dec = json_decode($res, true);
if (!$dec) throw new Exception('Invalid data: '.$res);
curl_close($ch);
return $dec;
}
$getinfo = array();
$devise = "EUR";
$url = "/buy-bitcoins-online/".$devise."/western-union/.json";
$getinfo = localbitcoins_query($url);
echo "<pre>"; print_r($getinfo); echo "</pre>";
连接到本地比特币并出现错误:
Fatal error: Call to undefined function curlerror() in C:\wamp\www\localbit\index.php on line 25
我认为这是我的 wamp 服务器,但不知道
我尝试了更多其他代码,但没有得到任何结果,现在我收到了这个错误!
这里有人知道 curl 的工作原理并告诉我我做错了什么很抱歉,如果这个问题是在我搜索它之前被问到的,但没有找到任何可以帮助我的东西
首先,正确的函数名称是curl_error
还要确保您已经加载了 wamp 的 php-curl 扩展。
您好,我使用 wamp 服务器和 apache:2.4.9 php:5.5.12 上的版本 我尝试将 curl 与此代码一起使用:
<?php
function localbitcoins_query($path, array $req = Array()) {
$key='MY_KEY';
$secret='MY_SECRET';
$mt = explode(' ', microtime());
$nonce = $mt[1].substr($mt[0], 2, 6);
if ($req) {
$get=httpbuildquery($req);
$path=$path.'?'.$get;
}
$postdata=$nonce.$key.$path;
$sign = strtoupper(hash_hmac('sha256', $postdata, $secret));
$headers = array(
'Apiauth-Signature:'.$sign,
'Apiauth-Key:'.$key,
'Apiauth-Nonce:'.$nonce
);
$ch = null;
$ch = curl_init('https://localbitcoins.com'.$path);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 20);
$res = curl_exec($ch);
if ($res === false) throw new Exception('Curl error: '.curlerror($ch));
$dec = json_decode($res, true);
if (!$dec) throw new Exception('Invalid data: '.$res);
curl_close($ch);
return $dec;
}
$getinfo = array();
$devise = "EUR";
$url = "/buy-bitcoins-online/".$devise."/western-union/.json";
$getinfo = localbitcoins_query($url);
echo "<pre>"; print_r($getinfo); echo "</pre>";
连接到本地比特币并出现错误:
Fatal error: Call to undefined function curlerror() in C:\wamp\www\localbit\index.php on line 25
我认为这是我的 wamp 服务器,但不知道 我尝试了更多其他代码,但没有得到任何结果,现在我收到了这个错误!
这里有人知道 curl 的工作原理并告诉我我做错了什么很抱歉,如果这个问题是在我搜索它之前被问到的,但没有找到任何可以帮助我的东西
首先,正确的函数名称是curl_error
还要确保您已经加载了 wamp 的 php-curl 扩展。