Author: Christian Lopes Date: 2010-11-29 07:45:48 -0800 (Mon, 29 Nov 2010) New Revision: 23021
Added: cytoscapeweb/trunk/website/src/file/php/ cytoscapeweb/trunk/website/src/file/php/proxy.php Log: PHP proxy for flash images--a workaround for using images from hosts that has no crossdomain.xml file. Added: cytoscapeweb/trunk/website/src/file/php/proxy.php =================================================================== --- cytoscapeweb/trunk/website/src/file/php/proxy.php (rev 0) +++ cytoscapeweb/trunk/website/src/file/php/proxy.php 2010-11-29 15:45:48 UTC (rev 23021) @@ -0,0 +1,49 @@ +<?php +// PHP Proxy +// Responds to both HTTP GET and POST requests +// +// Author: Abdul Qabiz +// March 31st, 2006 +// http://www.abdulqabiz.com/blog/archives/2007/05/31/php-proxy-script-for-cross-domain-requests/ + +// Get the url of to be proxied +// Is it a POST or a GET? +$url = ($_POST['url']) ? $_POST['url'] : $_GET['url']; +$headers = ($_POST['headers']) ? $_POST['headers'] : $_GET['headers']; +$mimeType =($_POST['mimeType']) ? $_POST['mimeType'] : $_GET['mimeType']; + + +//Start the Curl session +$session = curl_init($url); + +// If it's a POST, put the POST data in the body +if ($_POST['url']) { + $postvars = ''; + while ($element = current($_POST)) { + $postvars .= key($_POST).'='.$element.'&'; + next($_POST); + } + curl_setopt ($session, CURLOPT_POST, true); + curl_setopt ($session, CURLOPT_POSTFIELDS, $postvars); +} + +// Don't return HTTP headers. Do return the contents of the call +curl_setopt($session, CURLOPT_HEADER, ($headers == "true") ? true : false); + +curl_setopt($session, CURLOPT_FOLLOWLOCATION, true); +//curl_setopt($ch, CURLOPT_TIMEOUT, 4); +curl_setopt($session, CURLOPT_RETURNTRANSFER, true); + +// Make the call +$response = curl_exec($session); + +if ($mimeType != "") { + // The web service returns XML. Set the Content-Type appropriately + header("Content-Type: ".$mimeType); +} + +echo $response; + +curl_close($session); + +?> \ No newline at end of file -- You received this message because you are subscribed to the Google Groups "cytoscape-cvs" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/cytoscape-cvs?hl=en.
