Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3696502
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T04:44:48+00:00 2026-05-19T04:44:48+00:00

Hello friends I am running 2 applications on the same server and I wanted

  • 0

Hello friends I am running 2 applications on the same server and I wanted to import some content of Application-1 into Application-2 and similarly some content of Application-2 into Application-2.

Currently this is how I am getting it:

<?php
    $app1 = file_get_contents('http://localhost/cms');

    file_put_contents('cms.html', $app1); 

    $app2 = file_get_contents('http://localhost/blog');

    file_put_contents('blog.html', $app2); 
?>

Like this I am saving these 2 files with the HTML of those applications

Now lets say I have

a <div id="header"> in cms.html which I want to import in <div id="header"> of Application-2’s index.php file

and

a <div id="footer"> in blog.htmlwhich I want in <div id="footer"> of Application-1’s index.php file.

How do I do this?

UPDATE : Both applications are Joomla and WordPress.

My Template is a simple one without any JavaScript so kindly suggest a PHP solution until and unless it is compulsory to load JavaScript, I want to keep it simple and light.

Please also note I have just started learning programing hence It will be very difficult for me to understand too technical a language hence requesting a simple language. Hope you understand.

If my approach is wrong at the very first place, then please feel free to suggest a better method of doing this task.

Kindly help.

UPDATE 2 : Please not my issue is not of getting content from the other application. My issue is to get a fragment of the HTML file that is being generated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T04:44:48+00:00Added an answer on May 19, 2026 at 4:44 am

    Well I guess I found a better way of doing it myself so I am posting here as an answer for the sake of others who are looking for a similar solution.

    Write a class which will read between the markers and get that bit.

    <?Php
    class className {
        private $_content;
        private $_Top;
        private $_Bottom;
    
        public function __construct(
            $url, $markerStartTop = null, 
            $markerEndTop = null, 
            $markerStartBottom = null, 
            $markerEndBottom = null){
    
                $this->_content = file_get_contents($url);
                $this->_renderTop($markerStartTop, $markerEndTop);
                $this->_renderBottom($markerStartBottom, $markerEndBottom);
            }
    
        public function renderTop($markerStart = null, $markerEnd = null){
            return $this->_Top;
            }
    
        private function _renderTop($markerStart = null, $markerEnd = null){
            $markerStart = (is_null($markerStart)) ? '<!– Start Top Block –>' : (string)$markerStart;
            $markerEnd = (is_null($markerEnd)) ? '<!– End Top Block –>' : (string)$markerEnd;
    
            $TopStart = stripos($this->_content, $markerStart);
            $TopEnd = stripos($this->_content, $markerEnd);
    
            $this->_Top = substr($this->_content, $TopStart, $TopEnd-$TopStart);
            }
    
        public function renderBottom(){
            return $this->_Bottom;
            }
    
        private function _renderBottom($markerStart = null, $markerEnd = null){ 
            $markerStart = (is_null($markerStart)) ? '<!– Start Bottom Block –>' : (string)$markerStart;
            $markerEnd = (is_null($markerEnd)) ? '<!– End Bottom Block –>' : (string)$markerEnd;
    
            $BottomStart = stripos($this->_content, $markerStart);
            $BottomEnd = stripos($this->_content, $markerEnd);
    
            $this->_Bottom = substr($this->_content, $BottomStart, $BottomEnd-$BottomStart);
            }
    }
    ?>
    

    Call it:

    <?php
        $parts = new className('url/to/the/application');
        echo $parts->renderTop();
    ?>
    

    This method is fetching exactly the fragment of the content which you marked between the desired markers.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello we have an SQL server application running over a low bandwith connection. We
Hello friends i am running code given below which contains the setLogTimeEntery function and
hello friends i am using this galleria gallery link to display images on my
hello friends i am developing one intranet application called human resource information system using
Hello future friends who is gonna help me big time on this project, I
Hello friends a newbie question... The Issue is like this: I have a static
Hello friends I am developing application in which view has one textField & 2
Hello friends I created some custom fields for contacts. How can I insert values
Hello can anybody solve this please I'm creating the object in the action class
Hello , I am currently working on the student association's website. The student's association

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.