V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Reign
V2EX  ›  程序员

有讯飞的人么?你家的开放平台 api 为啥把法国 OVH 服务器全 ban 了?

  •  
  •   Reign · 2018-07-03 09:29:48 +08:00 · 2309 次点击
    这是一个创建于 2124 天前的主题,其中的信息可能已经有所发展或是发生改变。

    想测试一下讯飞的手写字体识别 api: http://webapi.xfyun.cn/v1/service/v1/ocr/handwriting ,本地测试良好,用我的 2 台美国 VPS 测试良好,用我的 5 台 ovh 服务器(全是法国 ip 地址),全部返回 404。。。无论我怎样修改 header 都 404,我在后台添加了服务器 ip 地址为白名单还是 404,为啥你们要把法国 ovh 全 ban 了?

    7 条回复    2018-07-04 10:50:24 +08:00
    a302800411
        1
    a302800411  
       2018-07-03 09:53:51 +08:00
    ping 的通吗
    Reign
        2
    Reign  
    OP
       2018-07-03 09:55:38 +08:00
    @a302800411 既然都返回 404 了肯定 ping 得通啊:
    PING webapi.xfyun.cn (121.201.83.170) 56(84) bytes of data.
    64 bytes from 121.201.83.170 (121.201.83.170): icmp_seq=1 ttl=43 time=310 ms
    64 bytes from 121.201.83.170 (121.201.83.170): icmp_seq=2 ttl=43 time=310 ms
    64 bytes from 121.201.83.170 (121.201.83.170): icmp_seq=4 ttl=43 time=311 ms
    a302800411
        3
    a302800411  
       2018-07-03 09:59:57 +08:00
    @Reign 你本地强制把 hosts 设置为 42.62.116.35 试试
    Reign
        4
    Reign  
    OP
       2018-07-03 10:12:26 +08:00
    @a302800411 非常感谢,改了 hosts 就通过了,另外请问一下,用 Python 跑官方 demo 能行,但是我用 php 改写老是提示“ 10107 错误 illegal parameter|illegal image format ”:
    <?php
    $base64=base64_encode(file_get_contents('1.jpg'));
    $time=time();
    $api_key = '******';
    $param=base64_encode('{"language": "en","location": "false"}');
    $content=file_get_contents('http://webapi.xfyun.cn/v1/service/v1/ocr/handwriting',false,stream_context_create(array(
    'http'=>array(
    'method'=>'POST',
    'header'=>
    "Content-Type: application/x-www-form-urlencoded; charset=UTF-8 \r\n".
    "X-Appid:****** \r\n".
    "X-CurTime:".$time." \r\n".
    "X-Param:".$param." \r\n".
    "X-CheckSum:".md5($api_key.$time.$param),
    'content'=>http_build_query(
    array(
    'image'=>urlencode($base64),
    )
    )
    )
    )));
    $arr=json_decode($content,true);
    print_r($arr);
    Reign
        5
    Reign  
    OP
       2018-07-04 10:11:14 +08:00
    @a302800411 你好,改成“ 42.62.116.35 ”昨天能行,今天又 404 了
    a302800411
        6
    a302800411  
       2018-07-04 10:40:21 +08:00
    @Reign 应该是你 dns 的问题,你别用固定 IP 了,换一个 dns 试试,我没写过 php,代码问题直接提交工单吧
    Reign
        7
    Reign  
    OP
       2018-07-04 10:50:24 +08:00
    @a302800411 谢谢
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1162 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 18:20 · PVG 02:20 · LAX 11:20 · JFK 14:20
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.