RT,请问php如何自动提交表单.
<form action="http://app.renren.com/pay/web4test/submitOrder" method="post" id="formdata" name="formdata" target="_top"><!--如果正式运行,需要改form的url-->
<div style="display:none">
<input type="hidden" name="app_id" value="140996"/>
<input type="hidden" name="order_number" id="order_number" value="<?php echo $order_id;?>"/>
<input type="hidden" size="50" name="token" id ="token" value="<?php echo $token;?>"/>
<input type="hidden" size="50" name="redirect_url" id="redirect_url" value="http://apps.renren.com/mohuanwang"/> 

</div>
</form>
没有确定按钮,这个页面我只是想过渡一下获取数据提交到别人的URL中。请问PHP如何处理这种问题?在线等谢谢

解决方案 »

  1.   

    您好,我以前查过这个问题,提了curl,请问可以说具体点吗?
    比如    $url = 'http://localhost/curl/result.php';
       $params = "param=123&param2=333"; //What will be posted
       $user_agent = "Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)";
       $ch = curl_init();
       curl_setopt($ch, CURLOPT_POST,1);
       curl_setopt($ch, CURLOPT_POSTFIELDS,$params);
       curl_setopt($ch, CURLOPT_URL,$url);
       curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
       curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
    是不是我的result页面就可以接收到这2个参数了?
    我试了下,没有成功- -!!!,谢谢了
      

  2.   

    你不是还没有 exec 吗?怎么知道不行?
      

  3.   

    <?php
       $url = 'http://localhost:81/renrenapp1/result.php';
       $params = "param=123&param2=333"; //What will be posted
       $user_agent = "Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)";
       $ch = curl_init();
       curl_setopt($ch, CURLOPT_POST,1);
       curl_setopt($ch, CURLOPT_POSTFIELDS,$params);
       curl_setopt($ch, CURLOPT_URL,$url);
       curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
       curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
       $result=curl_exec ($ch);  //execut
       curl_close ($ch);
           echo "Results: <br>".$result;?>
    result.php<?php
    print_r($_POST);?>
    找了个sample,运行时毫无反应,希望解释下,谢谢
      

  4.   

    哦,可以了,是php.ini没设置好,谢谢,我先调试下