http request problem

Discussion in 'PHP' started by mvnr_83, Nov 25, 2008.

  1. #1
    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
     
    mvnr_83, Nov 25, 2008 IP
  2. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #2
    You might try using a fork to have php send the requests silently in the background.

    http://us.php.net/pcntl_fork

    This gets into some tricky error / flow control, but if you can properly configure it, it should do what you are looking for.
     
    jestep, Nov 25, 2008 IP
  3. atlantaazfinest

    atlantaazfinest Peon

    Messages:
    389
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #3
    TRY curl it might get the job done!
     
    atlantaazfinest, Nov 25, 2008 IP
  4. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #4
    jestep, Dec 9, 2008 IP