PHP multiThreading

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mironline
    New Member
    • May 2008
    • 24

    PHP multiThreading

    Dear Friends

    I want to get web page contents with this method :

    Code:
    function getStatus($url)
    {
        $c = curl_init();
        curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($c, CURLOPT_URL, $url);
        $contents = curl_exec($c);
        curl_close($c);
        return   $contents ;
    }

    Is it possible to call Asynchronous this method ?

    Thank you.
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    Hi.

    I doubt you will be able to do that like you would in event-driven languages (like Java or C#), but you could possibly use the curl_multi_ functions to accomplish your goal. (Depending on what that goal is.)

    PHP was designed specifically for web-development, as a "hit-and-run" sort of language. Events and multi-threading doesn't really fit into that schema.

    Comment

    Working...