<?php
// 创建 curl 句柄
$ch = curl_init();
// 把编码后的字符串当做 GET 参数
$location = curl_escape($ch, 'Hofbräuhaus / München');
// 结果: Hofbr%C3%A4uhaus%20%2F%20M%C3%BCnchen
// 用编码好的字符串组装 URL
$url = "http://example.com/add_location.php?location={$location}";
// 结果:http://example.com/add_location.php?location=Hofbr%C3%A4uhaus%20%2F%20M%C3%BCnchen
// 设置选项并发送 HTTP 请求
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
?>