
Question:
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?
Answer1:<blockquote>
Whats wrong this this specific url?
</blockquote>The underscore.
From RFC 1912
<blockquote>Allowable characters in a label for a host name are only ASCII letters, digits, and the `-' character.
</blockquote><strong>Edit</strong>
After doing some more reading, it seems that Zend may be wrong in this case.
See <a href="https://stackoverflow.com/questions/2180465/can-someone-have-a-subdomain-with-an-underscore-in-it/2183140#2183140" rel="nofollow">Can (domain name) subdomains have an underscore "_" in it?</a>
According to <a href="http://www.zendframework.com/issues/browse/ZF-9671" rel="nofollow">ZF-9671</a>, you might be out of luck, though I've re-opened the issue.
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;
}
}