I've looked everywhere but can't find what I need so hence why I'm posting this question.
I'm looking for code for a PHP proxy to help me effectively do cross-domain jquery requests but have these requirements:
- Must be PHP
- Cannot use cURL -- my server config doesn't support it. Presumably this leaves fopen() but I'm open to alternatives.
- Must support both GET and POST requests
- Support both responses for either XML and JSON
I'e searched high and low for a solution but always find solutions that use cURL or doesn't support POST.
I'm currently using this which doesn't work for POST:
header('Content-type: application/json');
$daurl = $_GET['url'];
$handle = fopen($daurl, "r");
if ($handle) {
while (!feof($handle)) {
$buffer = fgets($handle, 4096);
echo $buffer;
}
fclose($handle);
}