因为我没怎么学过php,但是现在又需要一些功能的实现,所以厚颜来求代码,见谅。。
<?php$name = '刘著';
$pwd = '123456';
$url = 'http://www.baidu.com';//如何把[name]、[pwd] POST 到 [url] 去 ,并获得其返回值??$result = '????';echo $result;?>

解决方案 »

  1.   

    同是初学,关注此帖。
    建议csdn加入“关注此帖”的功能,类似mop那样的。
      

  2.   

    建议你看下http://dev.firnow.com/course/4_webprogram/php/phpjs/20100208/195371.html
      

  3.   

    你要放在這個url上 可以用get提交...
    http://www.baidu.com?name=xxx&pwd=xxx然後再提交的頁面用 $_GET["name"]
    这样获取.
      

  4.   

    没有测试, 自己测试一下.
    $formdata = 'name='.urlencode('刘著').'&pwd=123456';
    $opts = array(
      'http'=>array(
        'method'=>"POST",
        'header'=>"Accept: application/json, text/javascript, */*\r\n" .
                  "Content-Type: application/x-www-form-urlencoded\r\n".
                  "Content-Length: ".strlen($formdata)."\r\n",
         'content'=>"{$formdata}",
      )
    );$context = stream_context_create($opts);$return = file_get_contents('http://www.baidu.com/', false, $context);...
      

  5.   

    5#的代码可行的,谢谢啦,不过还有一个函数,vb的怎么转成php的?Function CodeToUni(code)
    Dim ix, thisStr, ThisCode, newcode
     
    If code = "" Then
       CodeToUni = ""
       Exit Function
    End If
     
    For ix = 1 To Len(code)
        thisStr = Right(Left(code, ix), 1)
        ThisCode = Hex(AscW(thisStr))
        If Len(ThisCode) = 1 Then
           ThisCode = "000" + ThisCode
        ElseIf Len(ThisCode) = 2 Then
           ThisCode = "00" + ThisCode
        ElseIf Len(ThisCode) = 3 Then
           ThisCode = "0" + ThisCode
        End If
        newcode = newcode + ThisCode
    Next
        
    CodeToUni = newcode
           
    End Function==============================
    CodeToUni(“测试”) = “6D4B8BD5”
      

  6.   

    构造一个 POST 过去网站就行了