稍微有點水平的一看就能明白我講的是啥吧...有的內容略...這個東西不能留下能直接用的.培養大家的開發能力. 去掉了關鍵注釋
<?php
* @name test.php
* @date thu jan 24 00:24:20 cst 2008
* @author 馬永佔(myz)
* @link
header("content-type: text/html;charset=utf-8");
$url = '';
$post = 1;
$returntransfer = 1;
$port = 80;
$header = 0;
$nobody = 0;
$myz = rand(1,9);
$request = 'myz='.$myz.'&password=123';
$cookie_jar = tempnam('./tmp','cookie.txt');
$ch = curl_init();
$options = array(curlopt_url => $url,
curlopt_header => $header,
curlopt_nobody => $nobody,
curlopt_port => $port,
curlopt_returntransfer => $returntransfer,
curlopt_post => $post,
curlopt_postfields => $request,
curlopt_cookiejar => $cookie_jar
curl_setopt_array($ch, $options);
echo curl_exec($ch);
//print_r(curl_getinfo($ch));
curl_close($ch);
$ch2 = curl_init();
$options2 = array(curlopt_url => $url,
curlopt_header => $header,
curlopt_nobody => $nobody,
curlopt_port => $port,
curlopt_returntransfer => $returntransfer,
curlopt_post => $post,
curlopt_postfields => $request,
curlopt_cookiefile => $cookie_jar
curl_setopt_array($ch2, $options2);
echo curl_exec($ch2);
//print_r(curl_getinfo($ch));
curl_close($ch2);
//不使用curlopt_returntransfer,結合ob也可以操作...反正這不是重點...
//ob_start("callback");
//echo "這裡是頁面的輸出";
//ob_end_flush();
//function callback($buffer)
// $buffer .= " --- by 馬永佔";
// file_put_contents('test.txt',$buffer);
// return "儲存成功";
CURL模擬登陸
created by phpstorm.user machenike date 2016 7 8 time 13 40 header content type text html charset utf 8 set time limit 0 關閉請求時間 cookie tempnam cookie ...
Shell 利用 curl 模擬登陸
b 引數 指定使用cookie檔案 c是往cookie檔案中寫cookie d 是指定此次登入所需的引數,通過httpfox檢視 l 指定頁面自動跳轉 curl c ck.txt user agent mozilla 4.0 d username password server id 1 submi...
curl登陸後模擬登陸並訪問登陸後的頁面
header content type textml charset utf 8 採集的資訊需要先登入的就要先模擬登入 設定cookie儲存路徑 cookie path ch curl init 組裝使用者名稱和密碼 info username 141391000914 info password ...