欢迎使用 UPS 成都网点查询服务。您可以使用此服务查询成都地区的 UPS 网点地址、电话号码和营业时间。
$address,'country' => '中国','state' => '四川省','city' => '成都市',);$curl = curl_init();curl_setopt($curl, CURLOPT_URL, $url);curl_setopt($curl, CURLOPT_POST, true);curl_setopt($curl, CURLOPT_POSTFIELDS, $post_data);curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);$result = curl_exec($curl);curl_close($curl);$dom = new DOMDocument();@$dom->loadHTML($result);$xpath = new DOMXPath($dom);$nodes = $xpath->query('//div[@class="loc-search-results-address"]');if ($nodes->length > 0) {echo '';echo '';foreach ($nodes as $node) {$name = $node->getElementsByTagName('h3')->item(0)->nodeValue;$address = $node->getElementsByTagName('address')->item(0)->nodeValue;$phone = '';$phone_nodes = $xpath->query('.//div[@class="loc-search-results-phone"]', $node);if ($phone_nodes->length > 0) {$phone = $phone_nodes->item(0)->nodeValue;}echo '';}echo '
网点名称
|
地址
|
电话号码
|
' . $name . '
|
' . $address . '
|
' . $phone . '
|
';} else {echo '
未找到与 "' . $address . '" 匹配的网点。
';}
}
?>