0
저는 프로그래밍뿐만 아니라이 코너에서도 새로운 편입니다. nusoap과 PHP를 기반으로 웹 서비스를 만들려고하고 있으므로 mysql 데이터베이스에서 값을 몇 개 전달합니다. 많은 웹 사이트 (스택 오버플로 응답 포함)를 둘러 보았습니다.하지만 시도했지만 성공하지 못한 몇 가지 솔루션을 발견했습니다. 어떤 이유로 클라이언트에 서비스를 액세스 할 때 항상 비어있게됩니다. 하루 만에이 글을 보았는데 지금은 편지 만 볼 수 있습니다 ...PHP는 내용을 전달하지 않습니다.
누군가가 솔루션을 제공 할 수 있다면 많은 도움이 될 것입니다. 고맙습니다!
서버 측
<?php
include 'nusoap.php';
$server=new nusoap_server();
$server->configureWSDL("demo"."urn:demo");
$server->register(
'gamedata',
array(),
array("estadio"=>'xsd:string',
"nome"=>'xsd:string',
)
);
function gamedata(){
$con=mysql_connect('127.0.0.1:3306', 'root', '') or die ("Erro ao conectar...");
mysql_select_db("testar",$con) or die ("Erro ao seleccionar DB...");
$queryforestadio="SELECT nome,cidade FROM estadio";
//$queryforjogos = "SELECT data, id_selecao1, id_selecao2 FROM jogo";
while($resultestadio = mysql_fetch_array($queryforestadio)){
$estadios[] = array('nome'=>$resultestadio['nome'],
'cidade'=>$resultestadio['cidade'],
);
echo "Message from function: ".$estadios['nome']['cidade'];
}
return $estadios;
}
if (!isset($HTTP_RAW_POST_DATA)) $HTTP_RAW_POST_DATA =file_get_contents('php://input');
$server->service($HTTP_RAW_POST_DATA);
?>
클라이언트 측
<?php
require('nusoap.php');
$client = new nusoap_client('http://localhost:8048/webservice/index.php');
$response= $client->call('gamedata');
$r = $response;
$count = count($r);
for($i=0; $i<=$count-1;$i++){
echo "This is name: ".$r[$i]['nome'];
echo "This is city: ".$r[$i]['cidade'];
}