我正在向查找艾滋病专家的搜索目录发出请求。以下是他们提供的文档:http://mobile.aahivm.org/getinfo.asmx?op=GetProviders
我使用PHP的cUrl发出请求。知道为什么没有回来吗?
<?php
$curlData = '<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<GetProviders xmlns="http://localhost">
<fname></fname>
<lname></lname>
<locationzip></locationzip>
<locationcity></locationcity>
<locationstate>New York</locationstate>
<locationcountry></locationcountry>
<primaryservicesid></primaryservicesid>
<credentials></credentials>
<specialty></specialty>
<specialtycare></specialtycare>
<support></support>
<paymentoptions></paymentoptions>
<member></member>
</GetProviders>
</soap12:Body>
</soap12:Envelope>';
$url='http://mobile.aahivm.org/getinfo.asmx?op=GetProviders';
$curl = curl_init();
$length = strlen($curlData);
curl_setopt ($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_VERBOSE, true);
curl_setopt($curl,CURLOPT_HTTPHEADER,array (
'POST /getinfo.asmx HTTP/1.1',
'Host: mobile.aahivm.org',
'Content-Type: application/soap+xml; charset=utf-8',
'Content-Length:'=>$length,
'SOAPAction: "http://localhost/GetProviders"'
));
curl_setopt ($curl, CURLOPT_POST, 1);
curl_setopt ($curl, CURLOPT_POSTFIELDS, $curlData);
//$result = substr(curl_exec($curl), 285, -72); ///remove SOAP envelope!
$result = curl_exec($curl);
print_r("Curl result: ".$result."<br><br><hr>");
curl_close ($curl);
$arr2 = array();
$arr2[] = json_decode($result, true);
////
foreach ($arr2 as $key=>$value) {
//echo $value;
$next[] = $value;
foreach ($next as $key=>$value) {
//echo $value;
$next[] = $value;
foreach ($next as $key=>$value) {
echo $key."=".$value."<br />";
}
echo "--<br /><br />";
}
}
/////
?>
答案 0 :(得分:-1)
您是否希望在响应中检索所有提供程序? 在他们的文档(http://mobile.aahivm.org/getinfo.asmx?op=GetProviders)中,它说“显示的占位符需要用实际值替换。”因此我假设你需要发送你的请求,为它搜索某种值。
希望这有点帮助