Debugging

Debugging transmitted requests and responses with pecl_http is actually pretty simple. Configure and send a request, then call the getRawRequestMessage and getRawResponseMessage methods on the request instance as shown below.

<?php
$request = new HttpRequest('http://localhost.example/index.php');
// configure $request
$request->send();

// returns a string containing the entire request
echo $request->getRawRequestMessage();

// returns a string containing the entire response
echo $request->getRawResponseMessage();
?>

© pecl_http PECL Extension — Web Scraping

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