Difference between revisions of "CC PHP-AJAX Chooser"

From Creative Commons
Jump to: navigation, search
 
Line 1: Line 1:
{{Template:Stub}}
+
The CC PHP-AJAX Chooser is a simple way to add a license chooser to your PHP-based web application.  It contains the following components:
 +
 
 +
* PHP Web Services client code
 +
* PHP Web Service proxy (to accommodate browser security)
 +
* Javascript and PHP for running the chooser itself.
 +
 
 +
It is licensed under the [http://opensource.org/licenses/mit-license.php MIT License] and is the same code used in the [[WpLicense]] [http://wordpress.org WordPress] extension.
  
 
== Getting the Code ==
 
== Getting the Code ==
 +
 +
The code is available from Subversion as part of the [http://sf.net/projects/cctools cctools project] at SourceForge.  You can retrieve the code using the Subversion command-line client using the following command:
 +
 +
$ svn co https://svn.sourceforge.net/svnroot/cctools/api_client/php/cc_ajax_chooser
 +
 +
Additional information: [http://subversion.tigris.org/ Subversion]
  
 
== Configuring ==
 
== Configuring ==
 +
 +
Before deployment you '''must''' configure the Javascript portion of the chooser to point to the web services proxy.  The <code>WS_ROOT_URL</code> variable in <code>js/chooser.js</code> must point to the URL <code>ws_proxy.php</code> is served from on your server.
 +
 +
The PHP Chooser code can optionally be configured in two ways:
 +
 +
* to use a particular version of the web services
 +
* to use a proxy for web service calls
 +
 +
For information on available versions of the web services, see the [http://api.creativecommons.org API documentation].  The code in Subversion defaults to the 1.5 version of the web services.  To change the version, update the <code>$WS_ROOT</code> variable in <code>ws_client.php</code>.
 +
 +
To configure a proxy for web service calls, edit the the <code>$PROXY</code> and <code>$USE_PROXY</code> variables in <code>ws_client.php</code>  The proxy server, <code>$PROXY</code>, should be specified without the <code>http://</code> prefix.
  
 
== Creating the Chooser ==
 
== Creating the Chooser ==
  
 
+
{{template:incomplete}}
  
 
[[Category:Developer]]
 
[[Category:Developer]]
 
[[Category:Developer:WebServices]]
 
[[Category:Developer:WebServices]]
 
[[Category:Technology]]
 
[[Category:Technology]]

Revision as of 18:04, 7 November 2006

The CC PHP-AJAX Chooser is a simple way to add a license chooser to your PHP-based web application. It contains the following components:

  • PHP Web Services client code
  • PHP Web Service proxy (to accommodate browser security)
  • Javascript and PHP for running the chooser itself.

It is licensed under the MIT License and is the same code used in the WpLicense WordPress extension.

Getting the Code

The code is available from Subversion as part of the cctools project at SourceForge. You can retrieve the code using the Subversion command-line client using the following command:

$ svn co https://svn.sourceforge.net/svnroot/cctools/api_client/php/cc_ajax_chooser

Additional information: Subversion

Configuring

Before deployment you must configure the Javascript portion of the chooser to point to the web services proxy. The WS_ROOT_URL variable in js/chooser.js must point to the URL ws_proxy.php is served from on your server.

The PHP Chooser code can optionally be configured in two ways:

  • to use a particular version of the web services
  • to use a proxy for web service calls

For information on available versions of the web services, see the API documentation. The code in Subversion defaults to the 1.5 version of the web services. To change the version, update the $WS_ROOT variable in ws_client.php.

To configure a proxy for web service calls, edit the the $PROXY and $USE_PROXY variables in ws_client.php The proxy server, $PROXY, should be specified without the http:// prefix.

Creating the Chooser