刚接触curl想用curl post信息,并且重定向到目的页面(带着发送的POST信息重定向)
<?php
$url = "http://localhost/opms/WebContent/test_output.php";
$post_data = array (
    "foo" => "bar",
    "query" => "Nettuts",
    "action" => "Submit"
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url); 
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION ,true);
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt');
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($ch, CURLOPT_MAXREDIRS,10);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
$output = curl_exec($ch);
curl_close($ch);照着网上的东西设置了很多也不知道有没有用,只不过想让最后地址栏的地址变为test_output.php,但总不成功。
是不是curl根本就不能跳转?还是我设置问题,求各位大大解答,谢谢!