If anyone else comes across this, you can access the date by modifying the allebrumWordpress.inc.php file:
if ($name == "dateCreated" || $name == "date_created_gmt") { $elements["$name"] = $xpath->query("value", $e)->item(0)->nodeValue; } else { $elements["$name"] = $xpath->query("value/string", $e)->item(0)->nodeValue; }
$blog = new AWP($domain, $user, $pass, $path); $id = $_GET["postid"]; $post = $blog->getPost($id); echo "<h2>".$post["title"]."</h2>"; echo $post["date_created_gmt"];
If you open up the allebrumWordpress.inc.php file you should see code like this:
function getPost($id){
$request = '
<value><string>'.$id.'</string></value>
<value><string>'.$this->user.'</string></value>
<value><string>'.$this->pass.'</string></value>
';
$xml = new DOMDocument();
$data = $this->query('metaWeblog.getPost', $request);
$xml->loadXML($data);
$xpath = new DomXPath($xml);
foreach($xml->getElementsByTagName('member') as $child){
$name = $xpath->query("name",$child)->item(0)->nodeValue;
$elements["$name"] = $xpath->query("value/string", $child)->item(0)->nodeValue;
}
return $elements;
}
It starts around line 154. Add an echo after this line: $data = $this->query('metaWeblog.getPost', $request);
so it looks like this:
$data = $this->query('metaWeblog.getPost', $request);
echo $data;
Save that and go open a webbrowser and go to the page that you are calling getPost() from. You should see a bunch of XML.
Depending on your web browser you may have to right-click and click on view source. But you should be able to see all the XML nodes.
This line in the allebrumWordpress.inc.php file is what reads all the nodes into an array: $elements["$name"] = $xpath->query("value/string", $child)->item(0)->nodeValue;
You will notice that it is looking for value/string nodes.
Well, what I believe happened is that datetime is not a <string> node. I haven't actually looked at this myself, but if you find a common node among all elements, just back the xpath back.
Example: If the XML file looks like this:
<post>
<value><string>date</string></value>
<value><time>time</time></value>
</post>
Then value is the common node among all of them.
So you would just need to change this line:
$elements["$name"] = $xpath->query("value/string", $child)->item(0)->nodeValue;
to look like this:
$elements["$name"] = $xpath->query("value", $child)->item(0)->nodeValue;
And that should allow you to pull the ["datetime"] value.
domain name = "domainname.com" user name = "admin" pass = "******" path = "/newsletter/xmlrpc.php"
DOM/XML enabled DOM/XML API Version 20020815 libxml Version 20616 HTML Support enabled XPath Support enabled XPointer Support enabled
A blank page is most always indicative of a php error. Can you turn on error reporting and post the php error or check your logs?