Skip to content

Instantly share code, notes, and snippets.

@tong
tong / bosh-proxy.php
Created May 22, 2012 09:03
PHP HTTP proxy for XMPP/BOSH connections using CORS
<?php
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Credentials: true ");
header("Access-Control-Allow-Methods: OPTIONS, GET, POST");
header("Access-Control-Allow-Headers: Content-Type, Depth, User-Agent, X-File-Size, X-Requested-With, If-Modified-Since, X-File-Name, Cache-Control");
$url = "http://example.com/http-bind"; // URI of the HTTP/BOSH gate to the XMPP server
$postdata = file_get_contents('php://input');