Zend HTTP客户端无效的URI? [英] Zend HTTP Client Invalid URI?

查看:116
本文介绍了Zend HTTP客户端无效的URI?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法在URL上使用Zend HTTP:

I'm having trouble using Zend HTTP on a URL:

$client = new Zend_Http_Client('http://xxfire_killumiex.api.channel.livestream.com/2.0/info.json');
$feed = $client->request()->getBody();

由于某种原因,这给了我一个错误...

For some reason, this gives me an error...

Invalid URI supplied

此特定网址有什么问题?

Whats wrong this this specific url?

推荐答案

此特定网址有什么问题?

Whats wrong this this specific url?

下划线.

从RFC 1912起

主机名标签中允许的字符仅为ASCII 字母,数字和-"字符.

Allowable characters in a label for a host name are only ASCII letters, digits, and the `-' character.

修改

多读一些书后,看来Zend在这种情况下可能是错的.

After doing some more reading, it seems that Zend may be wrong in this case.

请参见可以(域名)子域的下划线为"_",在里面吗?

根据 ZF-9671 ,您可能不走运,尽管我已经重新打开了问题.

According to ZF-9671, you might be out of luck, though I've re-opened the issue.

同时我的建议;像这样创建自己的HTTP客户端类

My suggestion in the meantime; Create your own HTTP client class like this

class My_Http_Client extends Zend_Http_Client
{
    public function validateHost($host = null)
    {
        if ($host === null) {
            $host = $this->_host;
        }

        // If the host is empty, then it is considered invalid
        if (strlen($host) === 0) {
            return false;
        }

        return true;
    }
}

这篇关于Zend HTTP客户端无效的URI?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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