private static function stream_setup($callback, $streamUrl) { //Set the internal callback function self::$callback = $callback; //Authenticate the socket to Oanda self::authenticate($streamHandle = curl_init()); //Setup the stream curl_setopt($streamHandle, CURLOPT_URL, $streamUrl); //Our callback, called for every new data packet curl_setopt($streamHandle, CURLOPT_WRITEFUNCTION, 'self::stream_callback'); return $streamHandle; }