You are here: Re: A quick question about xml-rpc « PHP Programming Language « IT news, forums, messages
Re: A quick question about xml-rpc

Posted by Ming on 05/10/07 23:06

Thanks Mike. I still do not quite understand. I do not have any class
that has getStateName method. It is an object in the remote machine
that has this method, isn't it? Correct me if I am wrong, it sounds it
is sufficient to just send $method = 'getStateName'

Ming

On May 10, 3:42 pm, Mike P2 <sumguyovrt...@gmail.com> wrote:
> On May 10, 4:47 pm, Ming <minghu...@gmail.com> wrote:
>
> > for the following code, why it uses $method = 'examples.getStateName';
> > instead of $method = 'getStateName'; or $method =
> > 'examples.getStateName()'
>
> > What does "example" here mean? Thanks
>
> > $method = 'examples.getStateName';
> > $args = array(32); // data to be passed
> > $request = compact('host', 'port', 'uri', 'method', 'args');
> > $result = xu_rpc_http_concise($request);
>
> It means the getStateName function is a method of the 'examples'
> object. You don't need to put parenthesis on the end of the method
> because there are never any arguments to put in there. The arguments
> in an xml-rpc request go in the 'args' index of the array you pass to
> xu_rpc_http_concise(). The whole thing with the compact() call
> basically does the same thing as this:
>
> <?php
> xu_rpc_http_concise(
> array(
> 'method' => 'examples.getStateName',
> 'args' => array( 32 ),
> 'host' => '...',
> 'port' => '...',
> 'uri' => '...'
> )
> )
> ?>
>
> ...because xu_rpc_http_concise() takes an associative array of it's
> arguments instead of just the arguments in the parenthesis on the
> function. What the example would look like if you were calling the
> same method if it were right in PHP would be something like:
>
> <?php
> $examples = new SomeClass();
> $result = $examples->getStateName( 32 );
> echo "I love $result!\n";
> ?>
>
> Where SomeClass is some class that has a getStateName() method that
> does whatever the xml-rpc method does.
>
> -Mike PII

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация