Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
52 views

XML RPC With The Incutio PHP Librar: A Beginner's Guide: Incutio Home Scripts Contact Manual Index

This document provides an introduction to XML-RPC and how to use the Incutio PHP Library to make and receive XML-RPC requests. XML-RPC allows different computers to execute functions remotely over the internet in a similar way to calling local PHP functions. The library makes it simple to create XML-RPC clients and servers. Examples are given of making requests to retrieve data, passing arguments, and handling errors. Creating an XML-RPC server with the library only requires mapping method names to functions.

Uploaded by

Weedhat Utol Uyo
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views

XML RPC With The Incutio PHP Librar: A Beginner's Guide: Incutio Home Scripts Contact Manual Index

This document provides an introduction to XML-RPC and how to use the Incutio PHP Library to make and receive XML-RPC requests. XML-RPC allows different computers to execute functions remotely over the internet in a similar way to calling local PHP functions. The library makes it simple to create XML-RPC clients and servers. Examples are given of making requests to retrieve data, passing arguments, and handling errors. Creating an XML-RPC server with the library only requires mapping method names to functions.

Uploaded by

Weedhat Utol Uyo
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

7/10/12

XML-RPC Librar - a Beginners Guide

INCUTIOHOME SCRIPTS CONTACT ManualIndex

XMLRPCwiththeIncutioPHPLibrar :ABeginner'sGuide
XMPRPCstandsforXMLRemoteProcedureCalling.Itisaprotocolformakingandreceivingprocedurecalls overtheinternet. WhatthismeansisthatdifferentcomputerscanuseXMLRPCto"askeachotherquestions".UsingXMLRPC isjustlikemakingafunctioncallinPHP,onlythecomputerthatexecutesthefunctioncouldbethousandsofmiles away. WiththeIncutioXMLRPCLibrary,makingandreceivingXMLRPCrequestsisalmostassimpleascalling nativePHPfunctions.Here'ssomesamplecode,whichcallsafunctionentitled"test.getTime"onoursimple demonstrationserver:
$client=newIXR_Client('http://scripts.incutio.com/xmlrpc/simpleserver.php') $client>query('test.getTime') print$client>getResponse() //Printsthecurrenttime,accordingtoourwebserver

Witherrorchecking,theabovecodelookslikethis:
$client=newIXR_Client('http://scripts.incutio.com/xmlrpc/simpleserver.php') if(!$client>query('test.getTime')){ die('Anerroroccurred'.$client>getErrorCode().":".$client>getErrorMessage()) print$client>getResponse()

Youcanalsosendargumentsalongwithyourqueries:
$client=newIXR_Client('http://scripts.incutio.com/xmlrpc/simpleserver.php') if(!$client>query('test.add',4,5)){ die('Anerroroccurred'.$client>getErrorCode().":".$client>getErrorMessage()) print$client>getResponse() //Prints'9'

Argumentsarenotlimitedtosimplevalues.Youcansendstringsandarraysaswell:
$client=newIXR_Client('http://scripts.incutio.com/xmlrpc/simpleserver.php') if(!$client>query('test.addArray',array(3,5,7))){ die('Anerroroccurred'.$client>getErrorCode().":".$client>getErrorMessage()) print$client>getResponse() //Prints'3+5+7=15'

WritinganXMLRPCserverissimpleaswell.Here'sthefullcodeforsimpleserver.php:
scripts.incutio.com/ mlrpc/beginners.php 1/3

7/10/12

XML-RPC Librar - a Beginners Guide

WritinganXMLRPCserverissimpleaswell.Here'sthefullcodeforsimpleserver.php:
<?php include('IXR_Library.inc.php') /*Functionsdefiningthebehaviouroftheserver*/ functiongetTime($args){ returndate('H:i:s') functionadd($args){ return$args[0]+$args[1] functionaddArray($array){ $total=0 foreach($arrayas$number){ $total+=$number returnimplode('+',$array).'='.$total /*CreatetheserverandmaptheXMLRPCmethodnamestotherelevantfunctions*/ $server=newIXR_Server(array( 'test.getTime'=>'getTime', 'test.add'=>'add', 'test.addArray'=>'addArray' )) ?>

Prett simplehuh? TheIncutioXMLRPCLibrar candoalotmorethanisdemonstratedabove.Besuretoreadthemanualfor moreinformation. Scripts ScriptsHome PHPXMLRPCLibrar PHPAma onSearch PHPGoogleWebAPI incDirector ssLinks

scripts.incutio.com/ mlrpc/beginners.php

2/3

7/10/12

XML-RPC Librar - a Beginners Guide

Design,Content,Images 20022012IncutioLimited|W3CXHTML1.0

scripts.incutio.com/ mlrpc/beginners.php

3/3

You might also like