2011-03-15 113 views
0

我在使用上的URL Zend的HTTP麻烦:Zend HTTP客户端URI无效?

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

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

Invalid URI supplied 

哪些错误这此特定网址?

回答

2

这是什么错这个具体的网址?

下划线。

从RFC在主机名称的标签,1912年

字符是唯一的ASCII 字母,数字和' - ”字符。

编辑

做一些更多的阅读后,似乎Zend的可能是错误在这种情况下。

Can (domain name) subdomains have an underscore "_" in it?

ZF-9671,你可能是出于运气,虽然我已经重开的问题。

我在此期间的建议;创建你自己的这样的HTTP客户端类

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; 
    } 
} 
+0

我跑了一个str_replace用%5F替换它,它没有什么区别。无论如何,下划线都是有效的URI字符,为什么它会成为一个问题? – 2011-03-15 22:14:35

+0

@Jason查看我的编辑 – Phil 2011-03-15 22:16:43

+0

@Jason这里是一个ZF用来验证URI的正则表达式'preg_match('/^[0-9.ae:.]*$/i',$ value)' – criticus 2011-03-15 22:19:39