• 请不要在回答技术问题时复制粘贴 AI 生成的内容
Reign
V2EX  ›  程序员

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

  •  
  •   Reign · Jul 3, 2018 · 2722 views
    This topic created in 2872 days ago, the information mentioned may be changed or developed.

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

    7 replies    2018-07-04 10:50:24 +08:00
    SkyEcho
        1
    SkyEcho  
       Jul 3, 2018
    ping 的通吗
    Reign
        2
    Reign  
    OP
       Jul 3, 2018
    @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
    SkyEcho
        3
    SkyEcho  
       Jul 3, 2018
    @Reign 你本地强制把 hosts 设置为 42.62.116.35 试试
    Reign
        4
    Reign  
    OP
       Jul 3, 2018
    @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
       Jul 4, 2018
    @a302800411 你好,改成“ 42.62.116.35 ”昨天能行,今天又 404 了
    SkyEcho
        6
    SkyEcho  
       Jul 4, 2018
    @Reign 应该是你 dns 的问题,你别用固定 IP 了,换一个 dns 试试,我没写过 php,代码问题直接提交工单吧
    Reign
        7
    Reign  
    OP
       Jul 4, 2018
    @a302800411 谢谢
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1220 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 17:37 · PVG 01:37 · LAX 10:37 · JFK 13:37
    ♥ Do have faith in what you're doing.