http request problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mvnr_83
Forum Newbie
Posts: 3
Joined: Thu Mar 27, 2008 5:45 am

http request problem

Post by mvnr_83 »

Hi All,

I have one requirement that, i am displaying results getting from various sites by sending request to their servers using http_client::get method.But it is taking much longer time to get back the response.
I am using for loop to send the requests to all the servers(approx 40).So it is taking around 10 secs to complete all the requests.

Please can you suggest me is there any way to send all the requests in a single attempt and get back the response in the same order.

Is php Supports multithreading?.If so, how can we solve this problem using multithreading.

I tried in many ways and didn't found any solution for my problem.Please help me to get out from this .
Reply With Quote
User avatar
novice4eva
Forum Contributor
Posts: 327
Joined: Thu Mar 29, 2007 3:48 am
Location: Nepal

Re: http request problem

Post by novice4eva »

Sadly PHP doesn't support multi-threading yet!! But maybe CURL will come to rescue, haven't used it but a quick google search says that this is friendly to the server resources.
http://www.php.net/manual/en/function.c ... i-exec.php
User avatar
pcoder
Forum Contributor
Posts: 230
Joined: Fri Nov 03, 2006 5:19 am

Re: http request problem

Post by pcoder »

PHP can fork itself.
You can go through this also.
8)
Post Reply