如何使用PHP从SOAP获取数据

如何使用PHP从SOAP获取数据,php,soap,Php,Soap,我有这一页: 我需要获得第一个“艺术家”和“标题”标签的数据: 字符串 一串 有人能帮我吗?我已经完全修改了我先前的答案,因为我没有意识到您无法从web服务中获取真实数据。您可以使用SOAP客户端访问它。可选参数可以传递给客户端函数,如下所示: $client->GetNowPlaying(array('foo'=>'bar')) …但是,我真的不知道这个web服务是做什么的,我也不知道要发送什么参数。无论如何,下面将得到一个响应: // service description

我有这一页:

我需要获得第一个“艺术家”和“标题”标签的数据:

字符串
一串

有人能帮我吗?

我已经完全修改了我先前的答案,因为我没有意识到您无法从web服务中获取真实数据。您可以使用SOAP客户端访问它。可选参数可以传递给客户端函数,如下所示:

$client->GetNowPlaying(array('foo'=>'bar'))
…但是,我真的不知道这个web服务是做什么的,我也不知道要发送什么参数。无论如何,下面将得到一个响应:

// service description http://mncmeorne.no-ip.org/NowPlaying.asmx?WSDL

// send request
$client = new SoapClient("http://mncmeorne.no-ip.org/NowPlaying.asmx?WSDL");
$result = $client->GetNowPlaying();

// get array of items
$arr = $result->GetNowPlayingResult->PlayerItem;

// iterate and access the artist property of the item
foreach ($arr as $i) {
    echo $i->Artist . "\n";
}

// examine what the SOAP response contains
echo var_dump($client);
echo var_dump($client->__getFunctions());
echo var_dump($result);

你能展示一下你想要达到的目标吗?我还没得到。我在寻找一些方法来获取stackoverflow上的数据,在web上。。。但是没有什么能帮助我理解如何获取数据。好吧,但是。。。如何直接从soap文件获取真实数据?数据大约每3分钟更改一次。@user3746625我修改了我的答案,再看一看。。。
// service description http://mncmeorne.no-ip.org/NowPlaying.asmx?WSDL

// send request
$client = new SoapClient("http://mncmeorne.no-ip.org/NowPlaying.asmx?WSDL");
$result = $client->GetNowPlaying();

// get array of items
$arr = $result->GetNowPlayingResult->PlayerItem;

// iterate and access the artist property of the item
foreach ($arr as $i) {
    echo $i->Artist . "\n";
}

// examine what the SOAP response contains
echo var_dump($client);
echo var_dump($client->__getFunctions());
echo var_dump($result);