URL Handling

By default, Zend_Http_Client uses Zend_Uri_Http to validate any URI that is passed into the client. Use of unconventional URLs, particularly those using characters described as disallowed by section 2.4.3 of RFC 2396 (the predecessor to RFC 3986), may cause validation failure. See the code sample below for how to deal with this situation.

<?php
// $valid will be false because the URL contains a |
$valid = Zend_Uri::check('http://localhost.example/?q=this|that');

// Force URLs with disallowed characters to be considered valid Zend_Uri::setConfig(array('allow_unwise' => true));

// $valid will be true because of allow_unwise being enabled $valid = Zend_Uri::check('http://localhost.example/?q=this|that');

// URLs with disallowed characters will be considered invalid again Zend_Uri::setConfig(array('allow_unwise' => false));
?>

© Zend_Http_Client — Web Scraping

>>> Back to TABLE OF CONTENTS <<<
Category: Article | Added by: Marsipan (01.09.2014)
Views: 381 | Rating: 0.0/0
Total comments: 0
avatar