Wrangling Headers

Handling headers is also relatively straightforward. The only header-specific convenience method that’s included is for handling Basic HTTP authentication, as shown below.

<?php
$request =& new HTTP_Request;
$request->addHeader('name', 'value');
$request->removeHeader('name');
$request->setBasicAuth('username', 'password');
?>

© PEAR::HTTP_Client — Web Scraping

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