title: PHP fsockopen stopped working since 20/05/2022
body: <p>In our stack we need websites to be able to fire and forget a request to central server.
  to do that we use a fsockopen. The code below has not been changed for years.</p>
  <pre><code>private function curl_post_async($url, $params = array()){
      $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);
  
      $out = &quot;POST &quot;.$parts['path'].&quot; HTTP/1.1\r\n&quot;;
      $out.= &quot;Host: &quot;.$parts['host'].&quot;\r\n&quot;;
      $out.= &quot;Content-Type: application/x-www-form-urlencoded\r\n&quot;;
      $out.= &quot;Content-Length: &quot;.strlen($post_string).&quot;\r\n&quot;;
      $out.= &quot;Connection: Close\r\n\r\n&quot;;
      if (isset($post_string)) $out.= $post_string;
  
      fwrite($fp, $out);
      fclose($fp);
  </code></pre>
  <p>As you can see we are not using the while loop with fgets as we dont care about the response. We just need that data sent to central server.
  We have not made any changes on any website or server in our network but as of Friday the 20th of May that function stopped working. We can get it to work by adding the while loop with fgets but that does not fit our requirements.</p>
  <p>We have sites sitting on range of server and central server on Azure.</p>
  <p>Interestingly enough the server it writes to has other apps on it. They also use this method and <strong>it works still</strong>.</p>
  <p>Anyone got any input on this or seeing similar problem ?</p>