PHP Classes

How Can PHP Get Remote Content from Another Server to Serve to Website Users Using the Package iCWLNet Website Builder PHP Install: Install a CMS to serve pages from remote sites

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: Not yet counted Not yet ranked
Version License PHP version Categories
icwlnet-website-buil 1.0GNU General Publi...5PHP 5, Content management, Web services, G...
Description 

Author

This package can install a CMS to serve pages from remote sites.

It provides an installer script that can download a ZIP file of the Bubble content management system.

The Bubble content management system pulls the content to serve to the user from a remote Web server that is used to manage the content.

Picture of Daniel ruul
Name: Daniel ruul <contact>
Classes: 1 package by
Country: Australia Australia
Innovation award
Innovation award
Nominee: 1x

 

Instructions

Bubble Content Management Distributed System, Install file.

Just extract the files into your web servers root directory or wherever you store your domains files.

Execute install.php from your browser and follow the instructions.

The iCreative Web Logic Networks Website Builder has been built from scratch and is a distributed type of custom Content Management System.

There are three tiers, top is the central administration management, second is the full website builder and third, last of all is the front end Content Delivery Network.

WordPress / Wix / Weebly / Square / Bubble.io are all similar projects.

Example

<?php

ini_set
( 'display_errors', '1' );

   
//----------------------------------------------------------------
   
function callback($buffer)
    {
        global
$tag_match_array;
      
// print "=101=======================================================\n<br>";
        //print_r($tag_match_array);
        //print "=102=======================================================\n<br>";
        //$sub_string_total="xx";
       
$match_array=array();
       
$inner_array=array();
       
$search=0;
       
$buffer_size=strlen($buffer);
       
$query="";
       
$str_match="";
       
$cur_match="";
       
$inner_match="";
       
$start_count=0;
       
$end_count=0;
       
$start_tag="[";
       
$end_tag="]";
        while(
$search<=$buffer_size){
       
           
$sub_string = substr($buffer, $search, 1);
            if(
$sub_string==$start_tag){
               
$start_count++;
               
$cur_match.=$sub_string;
            }elseif(
$sub_string==$end_tag){
               
$end_count++;
               
$cur_match.=$sub_string;
            }else{
                if(
$start_count>0){
                   
$cur_match.=$sub_string;
                   
$inner_match.=$sub_string;
                }
            }
            if((
$start_count==2)&&($end_count==2)){
               
$match_array[]=$cur_match;
               
$inner_array[]=$inner_match;
               
$cur_match="";
               
$inner_match="";
               
$start_count=0;
               
$end_count=0;
            }
           
$search++;
        }
        for(
$x=0;$x<count($match_array);$x++){
            if(isset(
$tag_match_array[$inner_array[$x]])){
               
$query.="| ".$x." |\n ".$inner_array[$x]."\n--".$match_array[$x]."=>".$tag_match_array[$inner_array[$x]];//var_export($tag_match_array[$inner_array[$x]],true);
               
$buffer=str_replace($match_array[$x], $tag_match_array[$inner_array[$x]], $buffer);
            }else{
               
$buffer=str_replace($match_array[$x], "", $buffer);
            }
        }
        return
$buffer;
    }

    function
download($file_source, $file_target) {
       
$rh = fopen($file_source, 'rb');
       
$wh = fopen($file_target, 'wb');
        if (
$rh===false || $wh===false) {
// error reading or opening file
          
return true;
        }
        while (!
feof($rh)) {
            if (
fwrite($wh, fread($rh, 1024)) === FALSE) {
                  
// 'Download error: Cannot write to file ('.$file_target.')';
                  
return true;
               }
        }
       
fclose($rh);
       
fclose($wh);
       
// No error
       
return false;
    }

    function
url_get_contents($url){
       
$useragent="curl";
       
$encoded="";
        if(
count($_GET)>0){
            foreach(
$_GET as $name => $value) {
               
$encoded .= urlencode($name).'='.urlencode($value).'&';
              }
        }
        if(
count($_POST)>0){
            foreach(
$_POST as $name => $value) {
               
$encoded .= urlencode($name).'='.urlencode($value).'&';
              }
        }
         
       
$encoded = substr($encoded, 0, strlen($encoded)-1);
       
$ch = curl_init();
       
curl_setopt($ch, CURLOPT_POSTFIELDS, $encoded);
       
curl_setopt($ch, CURLOPT_POST, 1);
       
curl_setopt($ch, CURLOPT_URL,$url);
       
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
       
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
       
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
       
//curl_setopt($ch, CURLOPT_COOKIEFILE, $this->cookieFile); // Cookie aware
        //curl_setopt($ch, CURLOPT_COOKIEJAR, $this->cookieFile); // Cookie aware
       
$result=curl_exec($ch);
       
curl_close($ch);
       
        return
$result;
    }

   
    function
Display($RemoteServer,$LocalServer,$DisplayPage){
       
$urldetails=$RemoteServer."?x=1&dcmshost=".$LocalServer."&dcmsuri=".$DisplayPage;
       
//print $urldetails;
       
$retdata=url_get_contents($urldetails);
        return
$retdata;
   
    }
   
//echo "xxx";
   
$message="";
   
$DisplayPageArray=explode("/",$_SERVER['REQUEST_URI']);
   
//$DisplayPage=$_SERVER['REQUEST_URI'];
   
if(isset($_GET['uri'])){
       
$DisplayPage=$_GET['uri'];
    }else{
       
$DisplayPage=urlencode("/");
    }
   
$OriginalDisplayPage=$DisplayPage;
   
//print "-".$DisplayPage."-";
   
$RemoteServer="w-d.biz/";
   
$LocalHost=urlencode($_SERVER['HTTP_HOST']);
   
$DisplayPage.="&LocalServer=".$LocalHost;
   
$LocalServer="install.me";
   
//print $DisplayPage."-".$RemoteServer."-".$LocalHost."-".$LocalServer."-\n<br>";
   
   
   
   
$source_code=Display($RemoteServer,$LocalServer,$DisplayPage);
   
   
$step=urldecode($OriginalDisplayPage);
   
//$message.=$step;
   
switch($step){
        case
"/":
           
$message='Step 1-';
           
$filename = './install.zip';

            if (
file_exists($filename)) {
               
$message.="The file $filename has already been downloaded";
            } else {
               
$file_url="http://assets.w-d.biz/downloads/Latest-BCMS_Distributed.zip";
               
$file_target="./install.zip";
               
download($file_url, $file_target);
            }
           
           

           
$filename = './install.zip';

            if (
file_exists($filename)) {
               
$message.="The file $filename exists";
            } else {
               
$message.="The file $filename does not exist";
            }
        break;
        case
"/step-2/":
           
//$message.='Step 2-<br>';
           
$total_count=0;
           
$zip = new ZipArchive;
            if (
$zip->open('./install.zip') === TRUE) {
               
$zip->extractTo('.');
               
$zip->close();
               
$message.='Files Unzipped<br>';
               
$total_count++;
            } else {
               
$message.='failed';
            }
           
$file_array=array();
           
$file_array[]="./";
           
$file_array[]="./index.php";
           
$file_array[]="./.htaccess";
           
$file_array[]="./info.php";
           
$file_array[]="./classes/clsDCMS.php";
           
$file_array[]="./classes/info.php";
           
$file_array[]="./cache";
           
$file_array[]="./cache/cookies";
           
$total_files=count($file_array);
           
           
$total_items=13;
           
$file_count=0;
           
$total_dirs=3;
           
$dir_count=0;
            foreach(
$file_array as $val){
                if (
file_exists($val)) {
                   
//$message.="$filename exists<br>";
                   
$file_count++;
                   
$total_count++;
                    if(
is_dir($val)){
                       
//$perms=fileperms($val);
                       
$perms=substr(sprintf('%o', fileperms($val)), -4);
                        if(
$perms>=666){
                           
$dir_count++;
                           
$total_count++;
                        }
                       
                    }
                   
//$message.=$val." exists<br>";
               
} else {
                  
// $message.=$val." does not exist<br>";
               
}
            }
           
$message.="Directory Permissions:- ".$dir_count." of ".$total_dirs."<br>";
           
$message.="Install Items:-".$file_count." of ".$total_files."<br>";

           
$test_source_code=Display($RemoteServer,$LocalServer,"/test/");
            if(
strlen($test_source_code)>0){
               
$message.="Search engine friendly URLS working<br>";
               
$total_count++;
            }else{
               
$message.="Search engine friendly URLS broken<br>";
            }
           
$Install_Percent=($total_count/$total_items)*100;
           
$message.="<br><br>Total Install Percent:- ".$Install_Percent."%<br>";


            if(isset(
$Install_Percent)){
                if(
$Install_Percent==100){
                   
$message.="<br><br><a href='install.php?uri=".urlencode("/step-3/")."'>Continue to Step 3</a><br>";
           
                }
            }
        break;

    }
   
//print "+1+".$message."++";
   
   

   
$tag_match_array["message"]=$message;
   
   
$source_code=callback($source_code);
    echo
$source_code;

   
?>


Details

iCWLNet Website Builder Install

This is the latest beta install of my website builder. You only need to run this file on a php supporting server and it downloads and extracts the Bubble CMS Distributed edition. The Distributed version acts like a proxy for your domain to request and display your website on your webserver with changes are made from my administration server.

Firstly you have to download install.php place it in your root apache directory e.g. :- public_http Run the file from your browser and fill in the required details. You should recieve an email and you will be forwarded to the central administration domain.

https://sitemanage.info

From here you can manage your websites details such as adding a page or even adding a free website. The administration lets you manage more that one website domain even on different servers.


  Files folder image Files (17)  
File Role Description
Files folder imageauth (2 files)
Files folder imagedata_sources (1 directory)
Files folder imageenvironments (5 files)
Files folder imagefunctions (2 files)
Files folder imagegraphql (1 file)
Files folder imagehttp_endpoints (1 file)
Files folder imagesync (1 file)
Accessible without login Plain text file install.php Example Example script
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation
Accessible without login Plain text file realm_config.json Data Auxiliary data

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads  
 100%
Total:0
This week:0