XOOPS RMCommon Utilities  2.1.8.91RC
 All Classes Namespaces Files Functions Variables
proxy.php
Go to the documentation of this file.
1 <?php
2 // $Id: proxy.php 996 2012-06-23 18:08:02Z i.bitcero $
3 // --------------------------------------------------------------
4 // EXM System
5 // Content Management System
6 // Author: Eduardo Cortés <i.bitcero@gmail.com>
7 // Email: i.bitcero@gmail.com
8 // License: GPL 2.0
9 // --------------------------------------------------------------
10 
11 include_once '../../../mainfile.php';
12 
13 
15 $xoopsLogger->renderingEnabled = false;
16 error_reporting(0);
17 $xoopsLogger->activated = false;
18 
22 class RMProxy
23 {
24  private $url = '';
25  private $type = '';
26 
27  function __construct($url, $type='text/html'){
28  $this->url = $url;
29  $this->type = $type;
30  }
31 
32  function get(){
33 
34  global $exmConfig;
35  // Creamos la petición
36  $hdrs = array(
37  'http'=>array(
38  'method'=>"POST",
39  'header'=>"Accept-language: "._LANGCODE."\r\n" .
40  "Referer: ".XOOPS_URL."\r\n"
41  )
42  );
43 
44  $context = stream_context_create($hdrs);
45  $content = file_get_contents(urldecode($this->url), false, $context);
46 
47  header("Content-Type: $this->type");
48 
49  return $content;
50  }
51 }