Posted by tomhung on August 14, 2008 at 11:47pm
Well there seems to be a lack of simple examples or documentation on connecting a PHP XML-RPC client to Drupal Services. If this example exists, I could not find it.
Here is my example code:
http://gregbosen.org/blog/drupal-services-php-xml-rpc-example
Please comment on it, if you have suggestions.
I wonder if this should be on the Example page in the handbook?
G

Comments
Indeed some non-flex
Indeed some non-flex examples are missing in Services docs, nice job. Maybe worth changing the code to be more Drupal (i.e. coding standards). btw, maybe this thread about integration with Rules module would interest you - http://groups.drupal.org/node/10376
Nice job indeed!
Excellent post. This needs to be a Drupal HOWTO, or at least linked to from the Services documentation. I'll create the link now, if I can. I should be able to - I'm have the documentation editor role. =)
Edit: posted in the Examples section: http://drupal.org/node/339845
I'm totally open to cleaning
I'm totally open to cleaning this example up. I just got it working and wanted to post it. I will post our Perl client when its done too.
G
mini-module
cool. maybe part of the cleaning up is making it as a Drupal module?
This really isn't suited for
This really isn't suited for a Drupal Module. This is more of code for an external php application that needs to use Drupal & its content.
We are using it as a GUI for a non Drupal application. IE. the user can CRUD their settings, and check log messages, and system status via drupal. But the real meat of the system is in PERL or PHP.
G
Hi Tomhung, I create another
Hi Tomhung,
I create another folder under my localhost called "php-xmlrpc" and then save a file called sample.php (attached a file here.). But it seems it does not work to me. What's lacking with this. Thanks.
I have already a folder named "drupal", and there I have setup my drupal installation under my localhost. Works fine. Permissions are setted properly already.
i'm guessing its a path problem
$c = new xmlrpc_client("drupal/?q=services/xmlrpc", "localhost", 80);this could be "drupal/xmlrpc.php"
it may be different if your clean urls are on. "drupal/services/xmlrpc"
check your paths, I had to play with this to get it to work.
i did find one thing... you must do a system.connect get the session, then send session to user.login and get a logged in session, then send that session to node.load.
http://gregbosen.org/blog/drupal-services-php-xml-rpc-example this is my best explanation of how to do this...
I hope this helps...
Hi Tomhung, I am doing your
Hi Tomhung,
I am doing your advised but it does not work. It displays the "else" error, it does not work.
API Key
It might have to do with you api key. If you are using an api key, the system.connect won't work as in the example.
Replace the lines with the following, or deactivate your api_key. Hope this is where your problem is.
$m = new xmlrpcmsg('system.connect',
array(
php_xmlrpc_encode([place api_key here])
)
);
Still does not work. Hi,
Still does not work. Hi, tomhung, have you tried tested it in your localhost?
where did this code go? the
where did this code go? the page no longer works, anyone have this and got it working, im just trying to do a simple connect from php --> services, using an api key, and pulling some data in..
help :)
im not using flash working on something else.
Where is the code?
Seems links have been modified
http://gregbosen.org/blog/drupal-services-php-xml-rpc-example
Where is it now?
HINT: seems like we would
HINT: seems like we would have to go to the college market coffee house. :)