Latest Entries »

Monday, January 18, 2010

How to send HTTP request using PHP?

There is a predefined php class called HttpRequest. By using this class we can create object for handle HTTP requests. There are list of function to handle it. Refer PHP manual and get some idea about this class.

In WAMP before use this objects you need to make some changes in php.ini file. Add following line into the php.ini file (somewhere near in the extension).



user HttpRequest object to handle get method http request

$r= new HttpRequest('', HttpRequest::METH_GET);
echo $r->getResponseBody();