简体   繁体   English

在Crunchbase API中处理特殊字符?

[英]Handle special characters in crunchbase API?

Does anybody know how to properly define a curl GET in PHP, for receiving data from the crunchbase API (v3.1) when there are special characters like french accents or umlauts? 是否有人知道如何在PHP中正确定义curl GET,以便在存在特殊字符(如法式重音符号或变音符号)时从crunchbase API(v3.1)接收数据?

I've tried replacing obvious characters with their "original forms", like ö -> o or ö -> oe or left them out completely. 我尝试用“原始形式”替换明显的字符,例如ö-> o或ö-> oe或将其完全排除在外。 And of course I tried encoding the part (or the whole url) with IDN, didn't work (w%C3%BCnsche). 当然,我尝试使用IDN编码部分(或整个url),但不起作用(w%C3%BCnsche)。 rawurlecode() also did not work. rawurlecode()也不起作用。 Interstingly enough, the official provided api link for the guy below also includes umlauts. 有趣的是,下面这个家伙的官方提供的api链接也包括变音符号。

// 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);

Instead of his profile, I get "No Mapping Rule matched". 而不是他的个人资料,我看到“没有匹配的映射规则”。

Does anyone know how encode special chars here with the crunchbase API? 有谁知道如何使用crunchbase API编码特殊字符? Thanks a lot! 非常感谢!

I had the same problem, asked Crunchbase support and got this reply: 我遇到了同样的问题,要求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. 我们的工程团队已意识到此问题,并计划为该API的未来版本合并一个修复程序。 In the meantime, we do recommend our customers using the UUID instead of the permalinks. 同时,我们建议客户使用UUID代替固定链接。

If you have the uuid of the person, that will work in the api call. 如果您拥有此人的uuid,则可以在api调用中使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM