1

我用 PHP cURL 编写了一个脚本来填写表格。但奇怪的是,表格只是被填满了,没有提交表格

这是代码请帮忙

$cookies = 'C:\wamp\www\costie\cookies.txt';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url1); // set url to post to 
curl_setopt($ch, CURLOPT_FAILONERROR, 1); 
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // allow redirects 
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable 
curl_setopt($ch, CURLOPT_TIMEOUT, 0); // times out after Ns 
curl_setopt($ch, CURLOPT_POST, 1); // set POST method 
curl_setopt($ch, CURLOPT_MAXREDIRS, 5);

curl_setopt($ch, CURLOPT_POSTFIELDS, "__EVENTTARGET=&__EVENTARGUMENT=&__VIEWSTATE=$value1&__PREVIOUSPAGE=$value2&__EVENTVALIDATION=$value3&$name1=2008&$name2=02-33-255-009&$name3=&$name4=&$name5=");//ADD post fields

curl_setopt($ch, CURLOPT_FAILONERROR, 1); 
curl_setopt($ch, CURLOPT_VERBOSE, 1); 
curl_setopt($ch, CURLOPT_HEADER, 1); 
curl_setopt($ch, CURLOPT_COOKIEFILE, 1);  
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookies);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookies);
$result = curl_exec($ch); // run the whole process 
curl_close($ch); 
echo $result;
4

0 回答 0