log in / join
Docs & Faqs - Syntax Highlighter

Service Keys - using services programmatically

If you want to use our services programmatically from your forum, blog or website, you need a service key first. Register and sign in, then you can require a service key on your account page.

A service key allows you to use our services, it identifies a communication process, so we can give you statistics about your activities based on your service keys. You can require more than one service key for the same account. Multiple service keys are useful if you want to distinguish your activities in our statistics. For example, if you want to use our syntax highlighter service from two different sites and you need statistics for them separately, use different service keys for them.
! Note that although the number of requests for a service key is unlimited, if our system detects an illegal use of service, the owner of the service key will be deleted from the members of Dottoro.
For example, you can use the highlighter service to color the source code posted by your members without any limitation, but you cannot build a highlighter service based on our syntax highlighter. The gratuitously large number of requests for the same service key also results in disqualification.
For the exact conditions, please read our Terms of Use.
If you have a service key, you can start to use our services.
  • All our services use SOAP to communicate. SOAP is an XML-based protocol that specifies the format for exchanging information.
  • The WSDL file that describes our services can be found here.
If you need detailed information about SOAP and WSDL, please visit the following links: Most programming languages today have support for SOAP. In the followings, we demonstrate the use of the syntax highlighter service from PHP only, but you can implement a SOAP client similarly in other languages.

This example demonstrates the use of the HTML syntax highlighter service. The YOUR_SERVICE_KEY text needs to be replaced with your service key.

<?php
$client = new SoapClient("http://tools.dottoro.com/axis2/services/codeTools?wsdl");

$request = array (
		'key' => "YOUR_SERVICE_KEY",
		'lang' => "HTML",
		'compress' => false,
		'lineNumbers' => true,
		'helpLinks' => true,
		'nofollow' => false,
		'tabSize' => 4,
		'viewPlainButton' => "View Plain",
		'copyButton' => "Copy to Clipboard",
		'printButton' => "Print",
		'source' => "<body>Hi!</body>"
		);

try {
    $response = $client->Highlight ($request);
}
catch (SoapFault $fault) {
        // An error occurred
    echo ("Error: " . $fault->faultstring);
    exit;
};
    /* Ok, the source property of the response contains 
       the source of the highlighted code */
echo ($response->source);
?>

Remarks:

  • If tabSize is zero, tab characters will be left as they are, they won't be replaced by spaces.
  • If any of the footer buttons (viewPlainButton, copyButton, printButton) need not be generated, assign an empty string to it.

If you have any further questions, please use the contact us form to get in touch with us.

Introduction
Customization
Themes
Plugins
Service Keys
News
Faq
Reported Bugs