Recurly连接错误 [英] Recurly Connection Error

查看:256
本文介绍了Recurly连接错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想recurly用于计费。
我只是有一个很简单的例子,像这样在测试我的 indexController的

I want to use recurly for billing. I just have a very simple example like this for testing in my indexController:

public function init() {
    require_once APPLICATION_PATH . '/../library/Recurly/recurly.php';
    Recurly_Client::$apiKey = Zend_Registry::get('config')->get('recurly')->get('apikey');
    Recurly_js::$privateKey = Zend_Registry::get('config')->get('recurly')->get('jskey');
    Recurly_Client::$subdomain = 'mysubdomain';
}

我的 recurlyAction

public function recurlyAction(){
    try{
        $invoices = Recurly_InvoiceList::get();
        foreach ($invoices as $invoice) {
            print "Invoice: $invoice\n";
        }
    }
    catch (Recurly_NotFoundError $e) {
        print 'Record could not be found';
    }
    catch (Recurly_ValidationError $e) {
        // If there are multiple errors, they are comma delimited:
        $messages = explode(',', $e->getMessage());
        print 'Validation problems: ' . implode("\n", $messages);
    }
    catch (Recurly_ServerError $e) {
        print 'Problem communicating with Recurly';
    }
    catch (Exception $e) {
        // You could use send these messages to a log for later analysis.
        print get_class($e) . ': ' . $e->getMessage();
    }
}

我试图来显示所有的发票,只是为了测试。现在的问题是,我总是得到这样的异常:

I'm trying to show all the invoices, just for testing. The problem is I always get an exception like this:

Recurly_ConnectionError:无法连接到Recurly

Recurly_ConnectionError: Failed to connect to Recurly.

我检查我的所有的var_dump在钥匙我的行为,他们都正确显示。我没有得到任何回应,你可以看到:

I've checked all my keys with var_dump in my Action and they all show up correctly. I don't get any response as you can see:

缓存控制:无店面,无缓存,必重新验证,检查后= 0,pre-检查= 0结果
  连接:保持活动结果
  内容编码:gzip结果
  内容长度:4853结果
  内容类型:text / html的结果
  日期:星期二,2013年10月1日6时54分36秒GMT结果
  到期日:星期四,1981年11月19日八时52分00秒GMT结果
  保持活动:超时= 5,最大= 100结果
  编译:no-cache的结果
  服务器:Apache / 2.2.22(Debian的)结果
  有所不同:接受编码结果
  的X已启动方式:PHP / 5.5.3-1〜dotdeb.1结果

Cache-Control:no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Connection:Keep-Alive
Content-Encoding:gzip
Content-Length:4853
Content-Type:text/html
Date:Tue, 01 Oct 2013 06:54:36 GMT
Expires:Thu, 19 Nov 1981 08:52:00 GMT
Keep-Alive:timeout=5, max=100
Pragma:no-cache
Server:Apache/2.2.22 (Debian)
Vary:Accept-Encoding
X-Powered-By:PHP/5.5.3-1~dotdeb.1

我和流浪箱的工作,会是什么问题?任何人可以帮助我呢?我坚持了下来几天现在...

I'm working with a vagrant box, could that be the problem? Can anybody help me with this? I'm stuck with it for a couple of days now ...

更新:结果
有时候我拿到发票,有时不...

UPDATE:
Sometimes I get the invoices, sometimes not ...

推荐答案

创建一个支持票上recurly,得到这样的回答:

Created a support ticket on recurly and got this answer:

您收到这样的连接到其他服务的任何错误?在client.php文件,连接超时设置为10(这应该是绰绰有余)。你可以尝试调整的。

Are you getting any errors like this connecting to other services? In the client.php file, the connection timeout is set to 10 (which should be more than enough). You could try adjusting that.

curl_setopt($ CH,CURLOPT_CONNECTTIMEOUT,10);

curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);

通常情况下,你应该没有编辑,但我把它改成30,现在能正常工作。

Normally, you shouldn't have to edit this but I changed it to 30 and now it works fine ..

这篇关于Recurly连接错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆