title: How can I send data/text from PHP using WebSocket to process?
body: <p>I have process on server which acts as WebSocket server (not written in Ratchet).  I want to be able to send data to this process using PHP (as client).</p>
  
  <p>I found a lot of examples to send as TCP like this:</p>
  
  <pre><code>&lt;?php
    $addr = gethostbyname("localhost");
  
    $client = stream_socket_client("tcp://$addr:8887", $errno, $errorMessage);
  
    if ($client === false) {
        throw new UnexpectedValueException("Failed to connect: $errorMessage");
    }
  
    fwrite($client, "GET / HTTP/1.0\r\nHost: localhost\r\nAccept: */*\r\n\r\n");
    echo stream_get_contents($client);
  ?&gt;
  </code></pre>
  
  <p>All I need I to send message to the process and close the connection.  The result that I expect is the result from the webSocket will be later printed or "echo" to the PHP page.</p>
  
  <p>Is there a way to make it work with <strong>curl</strong> in php?</p>