title: Return Array from PHP url
body: <p>I don't know whether this will be possible or not</p>
  
  <p>I am working on two website and I want to pass a array from one site to another through URL</p>
  
  <p>e.g.</p>
  
  <pre><code>$myreceivearray = http://mydomain/myscript.php
  </code></pre>
  
  <p>and this myscript.php should return an array.</p>
  
  <p>Again Adding some portion in the question</p>
  
  <p>As per the answer given i tried and my myscript.php code is</p>
  
  <pre><code>&lt;?php
  if (session_id() == "") session_start(); // Initialize Session data
  ob_start(); // Turn on output buffering
  ?&gt;
  &lt;?php include_once "ewcfg10.php" ?&gt;
  &lt;?php include_once "adodb5/adodb.inc.php" ?&gt;
  &lt;?php include_once "phpfn10.php" ?&gt;
  &lt;?php include_once "ACCOUNTinfo.php" ?&gt;
  &lt;?php include_once "userfn10.php" ?&gt;
  &lt;?php
  
  //
  // Page class
  //
  
  $custompage = NULL; // Initialize page object first
  
  class ccustompage {
  
      // Page ID
      var $PageID = 'custompage';
  
      // Project ID
      var $ProjectID = "{D5B1B389-2DCD-4664-BAD5-27C1596B8577}";
  
      // Page object name
      var $PageObjName = 'custompage';
  
      // Page name
      function PageName() {
          return ew_CurrentPage();
      }
  
      // Page URL
      function PageUrl() {
          $PageUrl = ew_CurrentPage() . "?";
          return $PageUrl;
      }
  
      // Message
      function getMessage() {
          return @$_SESSION[EW_SESSION_MESSAGE];
      }
  
      function setMessage($v) {
          ew_AddMessage($_SESSION[EW_SESSION_MESSAGE], $v);
      }
  
      function getFailureMessage() {
          return @$_SESSION[EW_SESSION_FAILURE_MESSAGE];
      }
  
      function setFailureMessage($v) {
          ew_AddMessage($_SESSION[EW_SESSION_FAILURE_MESSAGE], $v);
      }
  
      function getSuccessMessage() {
          return @$_SESSION[EW_SESSION_SUCCESS_MESSAGE];
      }
  
      function setSuccessMessage($v) {
          ew_AddMessage($_SESSION[EW_SESSION_SUCCESS_MESSAGE], $v);
      }
  
      function getWarningMessage() {
          return @$_SESSION[EW_SESSION_WARNING_MESSAGE];
      }
  
      function setWarningMessage($v) {
          ew_AddMessage($_SESSION[EW_SESSION_WARNING_MESSAGE], $v);
      }
  
      // Show message
      function ShowMessage() {
          $hidden = FALSE;
          $html = "";
  
          // Message
          $sMessage = $this-&gt;getMessage();
          $this-&gt;Message_Showing($sMessage, "");
          if ($sMessage &lt;&gt; "") { // Message in Session, display
              if (!$hidden)
                  $sMessage = "&lt;button type=\"button\" class=\"close\" data-dismiss=\"alert\"&gt;&amp;times;&lt;/button&gt;" . $sMessage;
              $html .= "&lt;div class=\"alert alert-success ewSuccess\"&gt;" . $sMessage . "&lt;/div&gt;";
              $_SESSION[EW_SESSION_MESSAGE] = ""; // Clear message in Session
          }
  
          // Warning message
          $sWarningMessage = $this-&gt;getWarningMessage();
          $this-&gt;Message_Showing($sWarningMessage, "warning");
          if ($sWarningMessage &lt;&gt; "") { // Message in Session, display
              if (!$hidden)
                  $sWarningMessage = "&lt;button type=\"button\" class=\"close\" data-dismiss=\"alert\"&gt;&amp;times;&lt;/button&gt;" . $sWarningMessage;
              $html .= "&lt;div class=\"alert alert-warning ewWarning\"&gt;" . $sWarningMessage . "&lt;/div&gt;";
              $_SESSION[EW_SESSION_WARNING_MESSAGE] = ""; // Clear message in Session
          }
  
          // Success message
          $sSuccessMessage = $this-&gt;getSuccessMessage();
          $this-&gt;Message_Showing($sSuccessMessage, "success");
          if ($sSuccessMessage &lt;&gt; "") { // Message in Session, display
              if (!$hidden)
                  $sSuccessMessage = "&lt;button type=\"button\" class=\"close\" data-dismiss=\"alert\"&gt;&amp;times;&lt;/button&gt;" . $sSuccessMessage;
              $html .= "&lt;div class=\"alert alert-success ewSuccess\"&gt;" . $sSuccessMessage . "&lt;/div&gt;";
              $_SESSION[EW_SESSION_SUCCESS_MESSAGE] = ""; // Clear message in Session
          }
  
          // Failure message
          $sErrorMessage = $this-&gt;getFailureMessage();
          $this-&gt;Message_Showing($sErrorMessage, "failure");
          if ($sErrorMessage &lt;&gt; "") { // Message in Session, display
              if (!$hidden)
                  $sErrorMessage = "&lt;button type=\"button\" class=\"close\" data-dismiss=\"alert\"&gt;&amp;times;&lt;/button&gt;" . $sErrorMessage;
              $html .= "&lt;div class=\"alert alert-error ewError\"&gt;" . $sErrorMessage . "&lt;/div&gt;";
              $_SESSION[EW_SESSION_FAILURE_MESSAGE] = ""; // Clear message in Session
          }
          echo "&lt;table class=\"ewStdTable\"&gt;&lt;tr&gt;&lt;td&gt;&lt;div class=\"ewMessageDialog\"" . (($hidden) ? " style=\"display: none;\"" : "") . "&gt;" . $html . "&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;";
      }
  
      //
      // Page class constructor
      //
      function __construct() {
          global $conn, $Language, $UserAgent;
  
          // User agent
          $UserAgent = ew_UserAgent();
          $GLOBALS["Page"] = &amp;$this;
  
          // Language object
          if (!isset($Language)) $Language = new cLanguage();
  
          // User table object (ACCOUNT)
          if (!isset($GLOBALS["ACCOUNT"])) $GLOBALS["ACCOUNT"] = new cACCOUNT;
  
          // Page ID
          if (!defined("EW_PAGE_ID"))
              define("EW_PAGE_ID", 'custompage', TRUE);
  
          // Start timer
          if (!isset($GLOBALS["gTimer"])) $GLOBALS["gTimer"] = new cTimer();
  
          // Open connection
          if (!isset($conn)) $conn = ew_Connect();
      }
  
      // 
      //  Page_Init
      //
      function Page_Init() {
          global $gsExport, $gsExportFile, $UserProfile, $Language, $Security, $objForm;
  
          // Security
          $Security = new cAdvancedSecurity();
          if (!$Security-&gt;IsLoggedIn()) $Security-&gt;AutoLogin();
  
          // Uncomment codes below for security
          //if (!$Security-&gt;IsLoggedIn())
          //  $this-&gt;Page_Terminate("login.php");
  
          if (@$_GET["export"] &lt;&gt; "")
              $gsExport = $_GET["export"]; // Get export parameter, used in header
          $this-&gt;CurrentAction = (@$_GET["a"] &lt;&gt; "") ? $_GET["a"] : @$_POST["a_list"]; // Set up curent action
          global $gbOldSkipHeaderFooter, $gbSkipHeaderFooter;
          $gbOldSkipHeaderFooter = $gbSkipHeaderFooter;
          $gbSkipHeaderFooter = TRUE;
  
          // Global Page Loading event (in userfn*.php)
          Page_Loading();
  
          // Page Load event
          $this-&gt;Page_Load();
      }
  
      //
      // Page_Terminate
      //
      function Page_Terminate($url = "") {
          global $conn;
          global $gbOldSkipHeaderFooter, $gbSkipHeaderFooter;
          $gbSkipHeaderFooter = $gbOldSkipHeaderFooter;
  
          // Page Unload event
          $this-&gt;Page_Unload();
  
          // Global Page Unloaded event (in userfn*.php)
          Page_Unloaded();
          $this-&gt;Page_Redirecting($url);
  
           // Close connection
          $conn-&gt;Close();
  
          // Go to URL if specified
          if ($url &lt;&gt; "") {
              if (!EW_DEBUG_ENABLED &amp;&amp; ob_get_length())
                  ob_end_clean();
              header("Location: " . $url);
          }
      }
  
      //
      // Page main
      //
      function Page_Main() {
          global $Security, $Language;
  
          //$this-&gt;setSuccessMessage("Welcome " . CurrentUserName());
          // Put your custom codes here
  
      }
  
      // Page Load event
      function Page_Load() {
  
          //echo "Page Load";
      }
  
      // Page Unload event
      function Page_Unload() {
  
          //echo "Page Unload";
      }
  
      // Page Redirecting event
      function Page_Redirecting(&amp;$url) {
  
          // Example:
          //$url = "your URL";
  
      }
  
      // Message Showing event
      // $type = ''|'success'|'failure'
      function Message_Showing(&amp;$msg, $type) {
  
          // Example:
          //if ($type == 'success') $msg = "your success message";
  
      }
  }
  ?&gt;
  &lt;?php ew_Header(FALSE) ?&gt;
  &lt;?php
  
  // Create page object
  if (!isset($custompage)) $custompage = new ccustompage();
  
  // Page init
  $custompage-&gt;Page_Init();
  
  // Page main
  $custompage-&gt;Page_Main();
  ?&gt;
  &lt;?php include_once "header.php" ?&gt;
  &lt;?php
  $custompage-&gt;ShowMessage();
  ?&gt;
  &lt;!-- Put your custom html here --&gt;
  &lt;?PHP
  $myarray = array(1,2,3,4,5);
  echo json_encode($myarray);
  ?&gt;
  
  &lt;?php include_once "footer.php" ?&gt;&lt;?php
  $custompage-&gt;Page_Terminate();
  ?&gt;
  </code></pre>
  
  <p>I can not change this all the code because I have to integrate to my old project. In the last 7 lines I put my code and when i open this page it only output as
  [1,2,3,4,5]
  and when I try to get this as</p>
  
  <pre><code>&lt;?PHP
  $myreceivearray = json_decode(file_get_contents('http://mydomain/blankpage.php'));
  print_r($myreceivearray);
  ?&gt;
  </code></pre>
  
  <p>I didn't get the array here.</p>
  
  <p>Please help me.</p>