0

Here is my socket.io extract

var httpServer = https.createServer(ssl, function(req,res) {
    console.log(req.method, req.url);
}).listen(999);
var io  = require('socket.io').listen(httpServer,{log:false});

Now, when I try to communicate through curl

<?php
function notifyNode($url, $port) {
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
    curl_setopt($ch, CURLOPT_PORT, $port);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2);
    curl_setopt($ch, CURLOPT_POST, true);
    $data = array('a' => 'hellwo world', 'b' => 'zaza');
    curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
    curl_exec($ch);
    curl_close($ch);
}    
notifyNode('https://example.com', 999);

This works fine: I got method and url in my node. But how to retrieve $data in socket.io ?

yarek
  • 11,278
  • 30
  • 120
  • 219

0 Answers0