eiai
V2EX  ›  PHP

PHP 如何实现中转 Android 端请求到 WebService

  •  
  •   eiai · Aug 26, 2014 · 4796 views
    This topic created in 4304 days ago, the information mentioned may be changed or developed.
    公司有一个只能接受来自某一IP请求的C# webservice,Android端无法直接访问。
    请教如何用PHP实现将Android端的请求发送到WebService再返回~谢谢
    9 replies    2014-08-27 21:18:01 +08:00
    ioth
        1
    ioth  
       Aug 26, 2014
    用php绕?
    .net可以用啊。
    dryyun
        2
    dryyun  
       Aug 26, 2014   ❤️ 1
    PHP 接收Android端的请求 可以实现不?
    PHP 发送请求到特定的webservice ,可以实现不?
    mengskysama
        3
    mengskysama  
       Aug 26, 2014   ❤️ 1
    不是httpproxy就可以了吗。哪有那么麻烦
    lichao
        4
    lichao  
       Aug 26, 2014   ❤️ 1
    <?php
    header('Content-type: text/plain;charset=utf-8');

    $daurl = $_GET['url'];

    $handle = fopen($daurl, "r");

    if ($handle) {
    while (!feof($handle)) {
    $buffer = fgets($handle, 4096);
    echo $buffer;
    }
    fclose($handle);
    }
    ?>

    供参考 https://gist.github.com/libuchao/4054663
    jsq2627
        5
    jsq2627  
       Aug 26, 2014 via iPhone   ❤️ 1
    HTTP请求转发?这个应该用 nginx 做吧。
    ChoateYao
        6
    ChoateYao  
       Aug 26, 2014   ❤️ 1
    上反向代理即可,何必搞的那么复杂???除非PHP还需要加工数据。
    eiai
        7
    eiai  
    OP
       Aug 26, 2014
    @ioth 因为IP访问限制只能绕
    @dryyun @mengskysama @jsq2627 @ChoateYao
    没接触过代理,nginx,感谢各位提供思路
    ioth
        8
    ioth  
       Aug 27, 2014
    @eiai 没看出来ip和语言工具平台有什么关系。
    eiai
        9
    eiai  
    OP
       Aug 27, 2014
    @ioth 抱歉,理解成为什么用php绕不直接用了=。=
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5693 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 63ms · UTC 01:39 · PVG 09:39 · LAX 18:39 · JFK 21:39
    ♥ Do have faith in what you're doing.