<?php
$cp=$_POST[cp];
$us=$_POST[us];
$s=file_get_contents('http://www.xxx.com/index.php?aid=$cp&mid=$us');
preg_match('<td valign=\"top\">(.*)<\/td>/isU',$s,$m);
print_r($m[1]);
?><form action ="php.php" method ="post">
<input type ="text" name ="cp" size ="3" maxlength ="5"/>
<input type ="text" name ="us" size ="3" maxlength ="5"/>
<input type="submit" value ="提交"/>
</form>其中index.php?aid=$cp和&mid=$us是一个数值或者中文,但提交无法传递数值,不知是哪个地方有误,请大家帮忙看看。

解决方案 »

  1.   


    if(!empty($_POST)){
    $cp=$_POST['cp'];
    $us=$_POST['us'];
    }
    print_r($_POST);  //查看是否有值
      

  2.   

    用index.php?aid=$cp和&mid=$us传值似乎应该用
    $cp=$_GET['cp'];
    $us=$_Get['us'];
    获取吧?
      

  3.   

    $s=file_get_contents('http://www.xxx.com/index.php?aid=$cp&mid=$us');
    ??????$s=file_get_contents("http://www.xxx.com/index.php?aid=$cp&mid=$us");
      

  4.   

    php组织规范的写法这样
    $url="http://www.xxx.com/index.php?aid=$cp&mid=$us";
    $s=file_get_contents($url);
      

  5.   

    这个是可以传递,但是小弟新手实在是弄不明白输出都有了,但是进入url了就是传递不了。
      

  6.   

    如果是echo "您输入的是".$cp;这样子显示是可以传递的,但是进入url就是不行,实在搞不明白什么问题。
      

  7.   

    比如:cp=123 但是到php这边cp还是$cp没有变化也没有报错
      

  8.   


    $s=file_get_contents("http://www.xxx.com/index.php?aid=".$cp."&mid=".$us);
      

  9.   

    PHP.ini中:
    ;;;;;;;;;;;;;;;;;;
    ; Fopen wrappers ;
    ;;;;;;;;;;;;;;;;;;; Whether to allow the treatment of URLs (like http:// or ftp://) as files.
    ; http://php.net/allow-url-fopen
    allow_url_fopen = On