topical media & game development 
  
 
 
 
 
  
    
    
  
 lib-ajax-example-relay.php / php
  <?php
  
  # List the allowed domain names below, between quote
  #   characters, with all but the last followed by a comma.
  #
  # This is to restrict opportunities for cross site
  #   scripting. Pages can only be retrieved from the
  #   domains listed here.
  #
  # In order to retrieve pages from both example.com and
  #   www.example.com, both domains must be listed.
  
  _SERVER['QUERY_STRING']) and preg_match('/^http:\/\//i',
  { url = _GET['url']) and preg_match('/^http:\/\//i',
  { url = _POST['url']) and preg_match('/^http:\/\//i',
  { url = checkdomain = preg_replace('/^http:\/\//i','',
  checkdomain = preg_replace('/\/.*checkdomain);
  checkdomain);
  AllowedDomains as checkdomain == strtolower(domainokay = true;
                  break;
          }
  }
  if(! url);
  exit;
  # When URL-aware fopen wrappers are not enabled, the
  #   following can be used.
  
  # Retrieve the page and echo it to the browser.
  
  # Break URL into host and URI parts.
  if(strpos(host = uri = url = preg_replace('/^.+?:\/\//','',
          pos = strpos(host = substr(pos);
          url,content
  fp = @fsockopen("errno,fp)
  {
          echo("Error: errno)");
          exit;
  }
  else
  {
  
          fwrite(uri HTTP/1.0\r\n");
          fwrite(host\r\n");
          if( isset(fp,'User-Agent: '.fp,"Connection: Close\r\n");
          fwrite(fp) )
          { fp,1024); }
          fclose(content,"\r") > 0 )
  { echo( preg_replace('/^.+?[\r\n]{4,}/s','',content) ); }
  ?>
  
  
  
(C) Æliens 
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher. 
In case of other copyright issues, contact the author.