EvoTalk

Posts Tagged ‘xmlrpc

06 十二月, 2007

PHP XML-RPC Client

Posted by: asd In: Code Snippet| Web| 程式設計

server 端同上篇用 perl 寫的,client 端改用 php 來 call。
參考

PHP XML-RPC 的使用(有效)
PHP XML-RPC Client(encode_xmlrpc) (有效)

view plain

PHP:

/**

* Debian: apt-get install php5-xmlrpc php5-curl

*/

 

/**

The MIT License

Copyright (c) 2007

Permission is hereby granted, free of charge, to any person obtaining a copy

of this software and associated documentation files (the "Software"), to deal

in the Software without restriction, including without limitation the rights

to use, copy, [...]

Tags: ,

06 十二月, 2007

Web Service: Use Perl XML-RPC

Posted by: asd In: Code Snippet| Perl| 程式設計

範例包含 server、client,執行前先使用 ppm 安裝「Frontier-RPC」、「Frontier-Daemon-Forking」modules。
參考「用 XML-RPC 開發 Web 服務: 針對 Perl 的 XML-RPC 入門」
Server
view plain

PERL:

#!/usr/bin/perl

# sum() server

 

use strict;

use warnings;

use Frontier::Daemon;

 

my $d = Frontier::Daemon->new(

methods => {

sum => \&sum,

},

LocalAddr => '127.0.0.1',

LocalPort => 1234,

);

 

sub sum {

my ($arg1, $arg2) = @_;

 

return $arg1 + $arg2;

}

Client
view plain

PERL:

#!/usr/bin/perl

# Testing sum()

 

use strict;

use warnings;

use Frontier::Client;

 

my $url  = "http://127.0.0.1:1234/RPC2";

my @args = (2,5);

 

my $client = Frontier::Client->new( [...]

Tags: ,


  • BK: 大於和小於在今日更廣泛地使用於標籤上,故在此補充該英文用法: : angle bracket []: square bracket
  • luh1688: 非常實用且謝謝!~
  • asd: 好的,不過很久沒修改了,不知道能不能動 寄到您的yahoo信箱
  • LIANG: nice post, thank you
  • Justmaker: 您好,請問可以跟你要source嗎?我最近有在看股票,想要enhance您的小工具,不知是否可以開放?

Category