处理 crunchbase API 中的特殊字符?
Handle special characters in crunchbase API?
有谁知道如何在 PHP 中正确定义 curl GET,以便在存在法国口音等特殊字符时从 crunchbase API (v3.1) 接收数据还是元音变音?
我尝试用 "original forms" 替换明显的字符,例如 ö -> o 或 ö -> oe 或完全忽略它们。当然,我尝试使用 IDN 对部分(或整个 url)进行编码,但没有成功 (w%C3%BCnsche)。 rawurlecode() 也不起作用。
有趣的是,官方为下面的家伙提供了 api link 还包括变音符号。
// This is an example name that causes the problem
$name = 'jan-wünsche';
// base url and key
$url = 'https://api.crunchbase.com/v3.1/people/' . urlencode($name) . '?
user_key=' . $KEY;
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $url
]);
$result = curl_exec($curl);
curl_close($curl);
我得到的不是他的个人资料,而是 "No Mapping Rule matched"。
有谁知道如何使用 crunchbase API 对特殊字符进行编码?非常感谢!
我遇到了同样的问题,询问了 Crunchbase 支持并得到了这样的回复:
Thanks for reaching out. Our engineering team is aware of this issue and they plan to incorporate a fix for the future version of the API.
In the meantime, we do recommend our customers using the UUID instead of the permalinks.
如果你有此人的 uuid,那将在 api 调用中起作用。
有谁知道如何在 PHP 中正确定义 curl GET,以便在存在法国口音等特殊字符时从 crunchbase API (v3.1) 接收数据还是元音变音?
我尝试用 "original forms" 替换明显的字符,例如 ö -> o 或 ö -> oe 或完全忽略它们。当然,我尝试使用 IDN 对部分(或整个 url)进行编码,但没有成功 (w%C3%BCnsche)。 rawurlecode() 也不起作用。 有趣的是,官方为下面的家伙提供了 api link 还包括变音符号。
// This is an example name that causes the problem
$name = 'jan-wünsche';
// base url and key
$url = 'https://api.crunchbase.com/v3.1/people/' . urlencode($name) . '?
user_key=' . $KEY;
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $url
]);
$result = curl_exec($curl);
curl_close($curl);
我得到的不是他的个人资料,而是 "No Mapping Rule matched"。
有谁知道如何使用 crunchbase API 对特殊字符进行编码?非常感谢!
我遇到了同样的问题,询问了 Crunchbase 支持并得到了这样的回复:
Thanks for reaching out. Our engineering team is aware of this issue and they plan to incorporate a fix for the future version of the API. In the meantime, we do recommend our customers using the UUID instead of the permalinks.
如果你有此人的 uuid,那将在 api 调用中起作用。