Mark--
Thanks for sharing a very useful approach. This API provides excellent
possibilities.
Before reading PBwiki API Hackers group, using the API Documentation
as my guide, yielded the following code concept snippet below.
Used the curl class curl.php found here:
http://github.com/shuber/curl/tree/master
which is a curl wrapper mentioned on
php.net.
http://www.php.net/manual/en/ref.curl.php
Download the class (changed from .php to .inc), read the docs, must
have curl installed.
// Produces contents of body of FrontPage in html which could be
embedded in an application.
<code>
<?php
require_once 'curl.inc';
$curl = new Curl;
$url = "
https://wikiname.pbwiki.com/api_v2/";
$vars = array(
"op" => "GetPage",
"page" => "FrontPage",
"_type" => "html",
"read_key" => "apikey";
);
$response = $curl->post($url, $vars);
// print_r($response->headers);
echo $response;
?>
</code>
// replace wikiname with your wiki name
// replace apikey with your pbwiki api read key
// you can replace FrontPage with any other valid page name
// uncomment the print_r... line to see headers
Try different "op" values in the array like GetBundle and GetOps
(remove the "page" key and value when doing this), and try changeing
"_type" to "text" or "jsontext" or "xml" till you get the results you
desire. From here you can quickly change and see how you are
interacting with the API. Your $vars array would look like this to
GetBundle.
<code> // array for GetBundle
$vars = array(
"op" => "GetBundle",
"_type" => "text",
"read_key" => "apikey";
);
<code>
Keep in mind when you use text you get a string that looks like and
array when done this way. It allows you to quickly test out various
API calls and see the results in a human readable fashion. There's
code in Marks demo to take the jsontext and get an array. And
according to Sean Huber's curl.php docs, $curl->cookie_file =
'some_other_filename'; should allow an entry point for maintaining
sessions across requests.
--WW
On Jan 11, 4:58 pm, "Mark Christian" <
mark.christ...@pbwiki.com>
wrote:
> demo.png
> 160KViewDownload
>
> pbwikiapi.zip
> 153KViewDownload