-1
이 웹 서비스에서 응답을 받고 싶습니다.어떻게 데이터를이 웹 서비스를 사용하여 PHP를 사용하여 얻을 수 있습니까?
http://www.w3schools.com/webservices/tempconvert.asmx
web_server.php 파일
<?php
function celcius($temp){
ini_set("soap.wsdl_cache_enabled", "0"); // disabling WSDL cache
$wsdl_path = "http://www.w3schools.com/webservices/tempconvert.asmx";
$client = new SoapClient($wsdl_path, array('trace' => 1)); //creating a SOAP Client
try {
$result = $client->CelsiusToFahrenheit(array("Celsius" => $temp));
$sxml = $client->__getLastResponse();
$xml = simplexml_load_string($sxml);
echo $xml;
$xml->registerXPathNamespace('soap', 'http://schemas.xmlsoap.org/soap/envelope/');
$ret_values = array("Fahrenheit"=>string);
return $ret_values;
}
catch (SoapFault $exception) {
echo $exception;
}
}
?>
나는 섭씨 기능을 변경하는 동안 SoapClient 함께 일하지만 시도하지 않은
<?php
temp_converter();
function temp_converter(){
include 'web_server.php';
$temprature = Array();
echo celcius("27");
$temprature = celcius("27");
try{
if($temprature['STATUS'] == 1){
echo json_encode($temprature);
}
else{
$temprature = array("Fahrenheit" => "");
echo json_encode($temprature);
exit();
}
}
catch(Exception $e){
echo $e->getMessage();
}
}
?>
실제 질문은 무엇입니까? 그런 일이 무엇입니까? 무슨 일이 일어날 것으로 예상됩니까? 이미 어떤 디버깅을 했습니까? –