Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

« Newer Snippets
Older Snippets »
Showing 1-2 of 2 total  RSS 

Post to Jaiku using PHP

This example uses the ProjectX API to post to Jaiku.com
<?php
  $msg = 'this is just a test message using the ProjectX API for posting to Jaiku';

  $xml_result =  simplexml_load_file('http://rorbuilder.info/api/projectx.cgi?xml_project=<project name="jaiku"><methods><method name="post"><params><param var="user" val="jrobertson"/><param var="msg" val="' . $msg . '"/><param var="location" val="London"/><param var="apikey" val="9ee6ffd165r364492"/></params></method></methods></project>');
  $method_result = $xml_result->post2jaiku;
  echo 'result' . $method_result;
?>


Reference: SimpleXML processing with PHP [ibm.com]

Debugging SimpleXML Objects

AGRH@!! SimpleXML bites the big one -- you can't even var_dump it to examine the contents and the controls are terrible. Luckily, you can convert it for debugging:

$sxml = simplexml_load_string($data);
// .. much hate between then and now... //
debugsxml($sxml);


function debugsxml($sxml) {
    $dom = dom_import_simplexml($sxml);
    printArray($dom);
}

function printArray($array){
    echo '<pre>';
    print_r($array);
    echo '</pre>';
}


« Newer Snippets
Older Snippets »
Showing 1-2 of 2 total  RSS