php平台向java servlet 传输数据,但不使用重定向header,否则就到java页面了。请问怎样能够将数据发过去??

解决方案 »

  1.   

    可用curl、fsockopen等方法实现
    最简单的用file_get_contents($url);  $url后面带上要传递的数据即可
      

  2.   

    谢谢Mr_merlin
    如果我的页面是a.php ,对方是b.jsp
     a.php 里面file_get_contents(http://192.168.1.2/b.jsp?id=123&name=tom)对方怎样接受这些数据,不是用post或get吧
      

  3.   

    String id = request.getParameter("id");
    String name = request.getParameter("name");
      

  4.   

    你的数据是用 get 方式传递的,对方当然也用 get 方式接受
      

  5.   

    还是不太会用file_get_contents这个函数,我写了个页面
    file_get_contents("http://127.0.0.1/test/test.php?name=tom");echo $_GET[name];啥也得不到啊
      

  6.   


    这个$_GET["name"] ,请到test.php文件里获取,,当前页面不是test.php,否则就是死循环
      

  7.   

    test1.php 里面写:<? php file_get_contents("http://127.0.0.1/test/test.php?name=tom"); ?>test.php 里面写 <?php  echo $_GET["name"]?>  结果这个页面啥也没有啊
      

  8.   


    那是当然,,你要访问test1.php,并且将代码改成
    echo  file_get_contents(……看看能否输出tom