Access CMSB from a remote server

3 posts by 2 authors in: Forums > CMS Builder
Last Post: September 2, 2011   (RSS)

By rcrofoot - September 1, 2011

Hello -

Befor I potentially spend (waste) alot of time on this on my own, I'm wondering if anyone has ever tried to access CMSB data from a PHP code page running on another server...

For example: My CMSB install and section editors/data are on "Server A"...On the site I working on, I need to jump over to "Server B" to do some special processing, but during the special processing, need to refer back to CMSB (on Server A) to get a piece of data...I can't get the piece of data before going over to Server B because it's only during the special processing on Server B that I know what data to get...

My first thought is to modify the "load viewer library" code that CMSB generates (on a PHP page on Server B) from:

// load viewer library
$libraryPath = 'cmsAdmin/lib/viewer_functions.php';
$dirsToCheck = array('/usr/www/users/brother/','','../','../../','../../../');


To something like this (URL now trying to access Server A where CMSB lives):

// load viewer library
$libraryPath = 'http://www.sitea.com/cmsAdmin/lib/viewer_functions.php';
$dirsToCheck = array('http://www.sitea.com/','','../','../../','../../../');

Does anyone happen to know if this approach is going to be something that'll be legal?

Thanks for the help,

Rick

Re: [rcrofoot] Access CMSB from a remote server

By Jason - September 2, 2011

Hi Rick,

The php require_once function normally doesn't work from an external server. Also, for security reasons, servers won't normally allow remote access to the database.

Is there a special reason why the processing has to take place on an external server?

There are other options for getting remote information. For example theirs the CMS Builder function getPage() that will return the content of a remote page:

example:
<?php
list($html, $httpStatusCode) = getPage("http://www.mysite.com/includes/mydata.php");
?>


You can then parse out the content form $html.

Hope this helps get you started.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/