doupi3874 2013-09-05 01:56
浏览 104
已采纳

API请求无效 - “无效的IP”

I'm working on a web app that talks to an API which authenticates requests by checking what IP they originated from. I've registered my test server with the API, but when I make a request, I get an XML response that says "Invalid IP."

To demonstrate the issue, I've made a bare-bones page which is just a button that when clicked makes a sample request and displays the response in the console: http://beta.pacificcoasttitle.com/test.html

I'm making the request using AJAX and a PHP proxy since its cross domain -- could this have something to do with the problem?

PHP proxy looks like this:

   <?php
   $file = file_get_contents($_GET['requrl']);
   echo $file;
   ?>
  • 写回答

1条回答 默认 最新

  • dongluo3962 2013-09-05 02:26
    关注

    I guess the access is not allowed for your server IP.

    However it is very easy to test that and be sure, just do:

    $url = 'http://rc.api.sitexdata.com/sitexapi/sitexapi.asmx/AddressSearch?Key=FFB6F23F-6FDA-4F16-A149-DB0834012C5F&Address=1432%20Dana%20Ave&LastLine=94301&ReportType=103&ClientReference=string&OwnerName=string';
    $file = file_get_contents($url);
    echo $file;
    

    My advice is that once you made it to work with pure PHP, then move to the ajax implementation. This way it is easier to debug anyway.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 关于#python#的问题:自动化测试
  • ¥20 问题请教!vue项目关于Nginx配置nonce安全策略的问题