大创管理系统数据采集
<?php
$id = (int)$_GET['id'];
if( !$id ){ echo 'id=',$id ; exit;}
// cookie
$COOKIE = 'UM_distinctid=1795620c51943d-0a48d291176f5d-930346c-1fa400-1795620c51a9e7; PHPSESSID=tsmcm6ih56b3mrcvqch6mko3df; _csrf=524fa079d45690c8ee29d51601a53584499f639a1772de0120bdaef3f04d1aaba%3A2%3A%7Bi%3A0%3Bs%3A5%3A%22_csrf%22%3Bi%3A1%3Bs%3A32%3A%22Ou99dGxB-xdJbkTLl1FNBYgQiAAqO6BR%22%3B%7D';
$url = 'http://............./admin/double/comp/flow/info';
// compid: 613
// entermemberid: 1535
// _csrf: CTZBFa-bhvJSz0yYzft2nzR-5PbCzMdbzO8cVFtqIqdqZwY49snJoyCiNOCdswatd0uJkKuOlROUoy0ODwVmkw==
// type: approve
$data = array();
$data['compid'] = 1003;
$data['compsubid'] = 201;
$data['entermemberid'] = $id;
$data['_csrf'] = 'x7ya8ofCN5jEB83esFkBxaZiIPImiytnCzjtEWoy0MyIyaPL44VP2ul_qZTSMlWJylNmvGTSTDZieaxgJQSSng==';
//$data['type'] = 'approve';
$html = httpPost($url,$data);
print_r($html);
/////////////////////
///
///
function httpPost($url,$data,$useCert=''){
// echo ."````".dirname(dirname(__FILE__));exit;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.33 Safari/537.36');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
global $COOKIE;
curl_setopt( $ch, CURLOPT_COOKIE, $COOKIE );
if($data != ""){
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
}
if(!empty($useCert)){
//设置证书
//使用证书:cert 与 key 分别属于两个.pem文件
curl_setopt($ch,CURLOPT_SSLCERTTYPE,'PEM');
curl_setopt($ch,CURLOPT_SSLCERT, $useCert['apiclient_cert']);
curl_setopt($ch,CURLOPT_SSLKEYTYPE,'PEM');
curl_setopt($ch,CURLOPT_SSLKEY, $useCert['apiclient_key']);
}
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$tmpInfo = curl_exec($ch);
if (curl_errno($ch)) {
return ("curl_error: ".curl_error($ch));
}
curl_close($ch);
return $tmpInfo;
}