title: How to make PHP request GET asynchronous
body: <p><strong>I want to make PHP request GET asynchronous</strong>, but my version PHP is 5.2.13 and the version of curl is 7.16.4, that has many limits.</p>
  
  <p>I tried:</p>
  
  <pre><code>curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
  curl_setopt($ch, CURLOPT_TIMEOUT, 1);
  </code></pre>
  
  <p>But it does not work. As I know, that just works from PHP 5.2.3</p>
  
  <p>So I read the other solution fsockopen:</p>
  
  <pre><code>function curl_request_async($url, $params, $type='POST')
    {
        if (count($params)&gt;0){
            $post_params = array();
  
            foreach ($params as $key =&gt; &amp;$val) {
              if (is_array($val)) $val = implode(',', $val);
              $post_params[] = $key.'='.urlencode($val);
            }
            $post_string = implode('&amp;', $post_params);
        }
  
        $parts    =   parse_url($url);
  
        $fp = fsockopen($parts['host'],
            isset($parts['port'])?$parts['port']:80,
            $errno, $errstr, 30);
  
        // Data goes in the path for a GET request
        if(('GET' == $type)&amp;&amp; isset($post_string)) $parts['path'] .= '?'.$post_string;
  
        $out = "$type ".$parts['path']." HTTP/1.1\r\n";
        $out.= "Host: ".$parts['host']."\r\n";
        $out.= "Content-Type: application/x-www-form-urlencoded\r\n";
        $out.= "Content-Length: ".strlen($post_string)."\r\n";
        $out.= "Connection: Close\r\n\r\n";
        // Data goes in the request body for a POST request
        if ('POST' == $type &amp;&amp; isset($post_string)) $out.= $post_string;
  
        fwrite($fp, $out);
        fclose($fp);
    }
  </code></pre>
  
  <p>that works with POST but that does not work with GET. I want to make the request GET asynchronous</p>
  
  <p>Anyone can help me ?</p>
  
  <p>Thank you so much</p>