<?php
class RQLBridge {
var $reddot = NULL;
var $xmlParser = NULL;
var $xmlQueryError = NULL;
var $xmlResponse = NULL;
function RQLBridge() {
$this->reddot = new COM("RDCMSASP.RdPageData") or die
("Unable to instantiate RedDot"); // *
}
function sendXML() {
# Create an instance of a RedDot Object
$this->reddot-
>XmlServerClassName="RDCMSServer.XmlServer"; // *
$vError = new Variant();
$lastResult = $this->reddot->ServerExecuteXml($this-
>xmlQuery,$vError);
$lastError = $vError->value;
if ($lastError != "") {
$this->xmlQueryError = $lastError;
return FALSE;
} else {
$this->xmlQueryError = FALSE;
$this->xmlResponse = $lastResult;
return TRUE;
}
}
function fetchXMLResponse() {
$this->xmlParser = xml_parser_create();
xml_parser_set_option($this->xmlParser,
XML_OPTION_CASE_FOLDING, 0);
xml_parser_set_option($this->xmlParser,
XML_OPTION_SKIP_WHITE, 1);
xml_parse_into_struct($this->xmlParser, $this-
>xmlResponse, $this->xmlValues, $this->xmlTags);
if (xml_get_error_code($this->xmlParser)) {
$this->xmlParseError = xml_error_string
(xml_get_error_code($this->xmlParser));
//$this->xmlErrorLineNumber =
xml_get_current_line_number($this->xmlParser);
return FALSE;
} else {
return TRUE;
}
xml_parser_free($this->xmlParser);
}
}
?>
Here's a very rough example... remember you'll have to simulate a full
login unless you pass the session ID and login guid from Red Dot to
your php script....
On Apr 22, 6:48 am, Jedi <[email protected]> wrote:
> Hi,
>
> I was wondering if anyone has an example of doing this in php, as I'm
> trying to change my RQL script from asp to php also.
> There are certain methods and functions I'm not clear on how to
> replicate from asp to php.
> If you look at my asp example and php example:
>
> ASP example:
> set objIO = Server.CreateObject("RDCMSASP.RdPageData")
> objIO.XmlServerClassName = "RDCMSServer.XmlServer"
> set objXMLDOM = Server.CreateObject("Microsoft.XMLDOM")
>
> xmlData = "<IODATA sessionkey=""<%inf_sessionkey%>""><PAGE guid=""<
> %inf_pageguid%>""><LINKS action=""load"" /></PAGE></IODATA>"
> xmlData = objIO.ServerExecuteXml(xmlData,sError)
> objXMLDOM.LoadXML(xmlData)
>
> elementname = "con_bodyarea"
> sElementGuid = objXMLDOM.selectSingleNode("//li...@eltname='" &
> elementname & "']").getAttribute("guid")
>
> 'list all pages that have been connected to the body container
> xmlData2 = "<IODATA sessionkey=""<%inf_sessionkey%>""><LINK guid="""
> & sElementGuid & """><PAGES action=""list""/></LINK></IODATA>"
> xmlData2 = objIO.ServerExecuteXml(xmlData2,sError)
> objXMLDOM.LoadXML(xmlData2)
>
> 'loop through the pages connected to the body container
> Set Pages = objXMLDOM.getElementsByTagName("PAGE")
> For Each Page In Pages
> 'get GUID of each page connected to the body container
> mypageguid = Page.getAttribute("guid")
> 'load details of each page connected to the body container
> xmlData3 = "<IODATA sessionkey=""<%inf_sessionkey%>""><PAGE
> action=""load"" guid=""" & mypageguid & """ /></IODATA>"
> xmlData3 = objIO.ServerExecuteXml(xmlData3,sError)
> objXMLDOM.LoadXML(xmlData3)
> 'get the template GUID that the page was created from
> TemplateGUID = objIO.GetAttribute
> ("PAGE","templateguid",xmlData3)
> Next
>
> PHP example only getting so far before hitting a brick wall:
> $reddot = new COM("RDCMSASP.RdPageData") or die("Unable to instantiate
> RedDot"); // *
> $reddot->XmlServerClassName="RDCMSServer.XmlServer"; // *
> $vError = new Variant();
>
> $pageguid = "BB64BDA788134E589B497A6815AD9FE1";
>
> $sXmlData = "<IODATA sessionkey='<%inf_sessionkey%>'><PAGE
> guid='$pageguid'><LINKS action='load' /></PAGE></IODATA>";
> $lastResult = $reddot->ServerExecuteXml($sXmlData,$vError);
> $lastError = $vError;
>
> The above all works and is fine but I'm getting stuck further down
> into my script where i'm trying to replicate the following into php:
> 1. objXMLDOM.selectSingleNode("//li...@eltname='" & elementname &
> "']").getAttribute("guid")
> 2. Set Pages = objXMLDOM.getElementsByTagName("PAGE")
> 3. mypageguid = Page.getAttribute("guid")
> 4. TemplateGUID = objIO.GetAttribute("PAGE","templateguid",xmlData3)
>
> I really hope there's someone out there that can help thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"RedDot CMS Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/RedDot-CMS-Users?hl=en
-~----------~----~----~----~------~----~------~--~---