http://localhost/vston/member/reg_new.php?regbase=123
如果我有这么一段提交,我想把这个提交改成POST的形式要怎么作呢???把传值能数变成POST的形式

解决方案 »

  1.   

    curl啊$url = 'http://localhost/vston/member/reg_new.php';
    $fields_string = 'regbase=123';
    $ch = curl_init() ;
    //set the url, number of POST vars, POST data
    curl_setopt($ch, CURLOPT_URL,$url) ;
    curl_setopt($ch, CURLOPT_POST,true) ;
    curl_setopt($ch, CURLOPT_POSTFIELDS,$fields_string) ;
    //execute post
    $result = curl_exec($ch) ;
    //close connection
    curl_close($ch) ; 
      

  2.   

    xmlhttphttp://www.w3schools.com/ajax/ajax_example.asp
      

  3.   

    用ajax的post方法<?php
    //reg_new.php
    if($_POST){
    echo $_POST['text'];
    }else{
    echo $_REQUEST['text'];
    }
    ?><input type="text" id="text" value="我是中国人">
    <input type="button" name="button" value="myAjax" onclick="post_test()"><script language="javascript">
    var request;
    function createxmlHttpRequest(){//判断浏览器类型,创建xmlHttpRequest对象
    if(!request){
    if(window.XMLHttpRequest){
    request = new XMLHttpRequest();
    }else{
    request = new ActiveXObject("Microsoft.XMLHTTP");
    }
    }
    }function post_test(){//post发送模式
    createxmlHttpRequest();
    var url = "reg_new.php";
    var send = "regbase=123";
    request.open("post", url);
    request.onreadystatechange = callback;
    request.setRequestHeader("content-type", "application/x-www-form-urlencoded");
    request.send(send);
    }function callback(){//回调函数
    if (request.readyState == 4){
    if (request.status == 200){
    alert(request.responseText);
    }else if(request.status == 404){
    alert("该路径未找到");
    }else if(request.status == 403){
    alert("禁止访问");
    }else{
    alert("status is " + request.status);
    }
    }
    }
    </script>
      

  4.   

    服务器 --> 服务器 curl
    浏览器 --> 服务器 ajax
      

  5.   

    这就一全局变量,你不初始化也行,
    ..............
    $_POST['regbase'] = 123;跳转到reg_new.php页面直接就可以用~~
      

  6.   

    只能ajax来做//Ajax
    function Ajax(){
    var _xmlHttp = null;
    this.createXMLHttpRequest = function(){try{if (window.ActiveXObject){_xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");}else if (window.XMLHttpRequest){_xmlHttp = new XMLHttpRequest();}}catch(e){alert(e.name +" : " + e.message);}}
    this.backFunction = function(_backFunction){if(_xmlHttp.readyState == 4){if(_xmlHttp.status == 200){_backFunction(_xmlHttp.responseText);}}_xmlHttp.onreadystatechange = null;}
    this.doPost = function(_url,_parameter,_backFunction){try{_xmlHttp.open("POST",_url, false);_xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");_xmlHttp.send(_parameter);}catch(e){alert(e.name +" : " + e.message);}}
    this.doGet = function(_url,_parameter,_backFunction){try{var _random = Math.round(Math.random()*10000);_xmlHttp.open("GET", (_url+"?random=" +_random +"&" + _parameter), false);_xmlHttp.send(null);}catch(e){alert(e.name +" : " + e.message);}}
    this.ajaxRequest = function(_url,_parameter,_method,_backFunction){try{this.createXMLHttpRequest();if(_method.toLowerCase() == "post"){this.doPost(_url,_parameter,_backFunction);}else{this.doGet(_url,_parameter,_backFunction);}try{_xmlHttp.onreadystatechange = this.backFunction(_backFunction);}catch(err){}}catch(e){alert(e.name+" : "+e.message);}}
    }
    function cDB(work,tab){
    if(work=='' || tab==''){return false;}
    var url = "Sys_Data.php?work=cdata&typ="+work+"&tab="+tab;
    var parameter = "";
    var method = "post";
    new Ajax().ajaxRequest(url,parameter,method,callBack);
    function callBack(xml){
    _g('t1').innerHTML=(xml.replace("\"",""));
    cHidden('PopMenu',0,1);
    }
    }
      

  7.   


    补充下
    服务器 --> 服务器 curl 或者socket