Skip to content

PHP: Proxy that shit!

I have a new best friend in town and his name is Proxy.

Basically this is a quick and easy work around for flash’s STUPID security issues.
You simply send your link (to a file on a different server) to the proxy(on your server) and flash thinks that those files are actually local files!

<?php

$url = 'http://';
if (isset($_GET['url']) && $_GET['url'] != '')
{
    $url .= $_GET['url'];
}

$mimeType = 'application/xml';

$response = file_get_contents($url);

if ($mimeType != "")
{
    header("Content-Type: ".$mimeType);
}
echo $response;

?>

and in ActionScript 2 you would call it like:

_xml.load( PROXY_URL + "?url=" + RSS_URL );

One Trackback/Pingback

  1. AS2 Twitter your Taxes – DrPunchBlog on Friday, February 12, 2010 at 12:59 PM

    [...] something I did for TurboTax. It’s an AS2 RSS reader. It’s also my first use of a PHP Proxy… and I think I’m in love. I wanna build PHP Proxy for everything now, even my [...]

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*