News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Mohammad Emran Hasan:
Concurrent HTTP requests in PHP using pecl_http
October 07, 2013 @ 10:42:09

Mohammad Emran Hasan has posted a quick example of using the pecl_http extension to make concurrent HTTP requests.

The pecl_http extension has a little gem that can be handy at times - HttpRequestPool. Using this, you can send concurrent HTTP requests and can gain efficiency in fetching non-related data at once. For example, from an external source if your application needs to retrieve an user's profile, their order history and current balance, you can send parallel requests to the API and get everything together.

His code shows three example connections to a made up URL on three different endpoints. With the HttpRequestPool functionality, all three can be requested at once and tracked to extract the response body.

0 comments voice your opinion now!
concurrent http request httprequestpool pecl peclhttp extension

Link: http://emranhasan.com/2013/09/concurrent-requests-in-php-using-pecl_http/

blog comments powered by Disqus

Similar Posts

Greg Beaver's Blog: behold pecl/phar and mighty PHP 5.3, also php|arch and php|tek

Mike Wallner's Blog: Round Up

CodeSamplez.com: PHP HTTP Request With Guzzle

Zend Developer Zone: Debugging PHP applications with xdebug

Irakli Nadareishvili's Blog: Install PECL Memcache with XAMPP and PHP4


Community Events

Don't see your event here?
Let us know!


api laravel voicesoftheelephpant example release performance php7 part2 symfony2 conference framework community interview podcast opinion configure language introduction series application

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework