API usage example
API DocumentationClass connection:
include_once('{path_to_lib}/mysitemapgenerator.lib.php'); $key={yourAPIkey};
Class initialization:
$API=new MySitemapGenerator($key);
By default, a JSON object is returned, but you can predetermine the returned data as a normal array:
$API->returntype="array";
And also enable the mode of explanations output:
$API->debug=true;
Get balance:
echo '<pre>'; print_r( $API->call("getBalance") ); echo '</pre>';
Get a list of updatable Sitemaps:
echo '<pre>'; print_r( $API->call("SitemapsGetList") ); echo '</pre>';
Get a Sitemap file for the site with ID 12345:
$params=Array( "cid"=>12345, ); echo '<pre>'; print_r( $API->call("SitemapsGetFiles",$params) ); echo '</pre>';
Create a new updatable Sitemap for the www.mysite.com site and update mode "every Monday". If successful, its ID is returned:
$params=Array( "site_url"=>"http://www.mysite.com/", "access_point"=>'Monday', ); echo '<pre>'; print_r( $API->call("SitemapsCreate",$params) ); echo '</pre>';
Change the Sitemap update settings for the site with ID 12345. In the example we change the update mode to Sunday and the way the crawler is identified:
$params=Array( "cid"=>12345, "access_point"=>"Sunday", "site_useragent"=>"google", ); echo '<pre>'; print_r( $API->call("SitemapsCreate",$params) ); echo '</pre>';
Delete site with ID 12345 from the list of updatable Sitemaps:
$params=Array( "cid"=>12345, ); echo '<pre>'; print_r( $API->call("SitemapsRemove",$params) ); echo '</pre>';