標有‘SOAP’的文章

在php內使用SOAP

1. 建立server端的php檔案 //接收要求的函數 function request($arg1, $arg2) { $response = $arg1 + $arg2; return $response; } // 宣告 SOAP Server $server=new SoapServer(NULL, array(‘uri’=>’http://myweb.com/’)); $server->addFunction(‘request’); // 定義 request 可以讓外部呼叫 $server->handle(); // 啟動 SOAP Server 2. 建立client端的php檔案 $client = new SoapClient(NULL, array(‘location’ => ‘http://127.0.0.1/soap/server.php’, ‘uri’ => “http://myweb.com/”)); try { print_r($client->request(1, 2)); } catch (SoapFault $err) { echo “Web Se […]

繼續閱讀...