茄子在线看片免费人成视频,午夜福利精品a在线观看,国产高清自产拍在线观看,久久综合久久狠狠综合

    <s id="ddbnn"></s>
  • <sub id="ddbnn"><ol id="ddbnn"></ol></sub>

  • <legend id="ddbnn"></legend><s id="ddbnn"></s>

    php采用curl模仿登錄人人網(wǎng)發(fā)布動(dòng)態(tài)的方法
    來源:易賢網(wǎng) 閱讀:772 次 日期:2014-11-13 14:05:55
    溫馨提示:易賢網(wǎng)小編為您整理了“php采用curl模仿登錄人人網(wǎng)發(fā)布動(dòng)態(tài)的方法”,方便廣大網(wǎng)友查閱!

    說到php中模仿登錄很多人第一時(shí)間會(huì)想到curl函數(shù)系列了,這個(gè)沒錯(cuò)本例子也是使用curl模仿登錄之后再進(jìn)行動(dòng)態(tài)發(fā)布,原理也簡(jiǎn)單我們只要抓取人人網(wǎng)的登錄信息,然后再由curl post登錄數(shù)據(jù)上去就可以了。

    具體代碼如下:

    代碼如下:

    $rconfig = pdo_fetch("SELECT * FROM ".tablename("eduTwo_renren")." WHERE weid = :weid",array(':weid'=>$_W['weid']));

    $cookie_file = dirname(__FILE__)."/renren.cookie";

    $login_url = 'http://passport.renren.com/PLogin.do';

    $post_fields['email'] = $rconfig['rusername'];

    $post_fields['password'] = $rconfig['rpassword'];

    $post_fields['origURL'] = 'http%3A%2F%2Fhome.renren.com%2FHome.do';

    $post_fields['domain'] = 'renren.com';

    $ch = curl_init($login_url);

    curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5');

    curl_setopt($ch, CURLOPT_HEADER, 0);

    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

    curl_setopt($ch, CURLOPT_MAXREDIRS, 1);

    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);

    curl_setopt($ch, CURLOPT_AUTOREFERER, 1);

    curl_setopt($ch, CURLOPT_POST, 1);

    curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields);

    curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);

    $content = curl_exec($ch);

    $info = curl_getinfo($ch);

    curl_close($ch);

    //var_dump($info);exit;

    //匹配用戶的ID

    $send_url='http://www.renren.com/home';

    $ch = curl_init($send_url);

    curl_setopt($ch, CURLOPT_HEADER, 0);

    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

    curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);

    curl_exec($ch);

    $info = curl_getinfo($ch);

    curl_close($ch);

    //$uid = "305115027";

    //獲取token和rtk

    $send_url=$info['redirect_url'];

    $ch = curl_init($send_url);

    curl_setopt($ch, CURLOPT_HEADER, 0);

    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

    curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);

    $tmp = curl_exec($ch);

    curl_close($ch);

    preg_match_all("/get_check:'(.*?)',get_check_x:'(.*?)',/is",$tmp,$arr);

    preg_match_all("/'ruid':'(.*?)',/is",$tmp,$utmp);

    //var_dump($utmp);exit;

    $token = $arr[1][0];//1121558104

    $rtk = $arr[2][0];//e9a9cb2

    $uid = $utmp[1][0];

    //echo $token;exit;

    //發(fā)布信息

    $poststr['content'] = $_GPC['content'].$rconfig['tail'];

    $poststr['withInfo'] = '{"wpath":[]}';

    $poststr['hostid:'] = $uid;

    $poststr['privacyParams'] = '{"sourceControl": 99}';

    $poststr['requestToken'] = $token;

    $poststr['_rtk'] = $rtk;

    $poststr['channel'] = "renren";

    $head = array(

    'Referer:http://shell.renren.com/ajaxproxy.htm',

    'X-Requested-With:XMLHttpRequest',

    );

    $ch = curl_init("");

    curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5');

    curl_setopt($ch,CURLOPT_HTTPHEADER,$head);

    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

    curl_setopt($ch, CURLOPT_MAXREDIRS, 1);

    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);

    curl_setopt($ch, CURLOPT_AUTOREFERER, 1);

    curl_setopt($ch, CURLOPT_POST, 1);

    curl_setopt($ch, CURLOPT_POSTFIELDS, $poststr);

    curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);

    $content = curl_exec($ch);

    curl_close($ch);

    //echo $content;exit;

    $data = json_decode($content,true);

    if($data["code"] == "0"){

    echo "發(fā)布成功!";

    }else{

    echo "shit !!!";

    }

    最后就發(fā)布成功了,當(dāng)然前面的數(shù)據(jù)庫需要自己寫一個(gè)吧,非常的簡(jiǎn)單的一個(gè)記錄庫也是你要發(fā)布的信息。錄數(shù)據(jù)上去就可以了。

    更多信息請(qǐng)查看IT技術(shù)專欄

    更多信息請(qǐng)查看網(wǎng)絡(luò)編程
    由于各方面情況的不斷調(diào)整與變化,易賢網(wǎng)提供的所有考試信息和咨詢回復(fù)僅供參考,敬請(qǐng)考生以權(quán)威部門公布的正式信息和咨詢?yōu)闇?zhǔn)!

    2026上岸·考公考編培訓(xùn)報(bào)班

    • 報(bào)班類型
    • 姓名
    • 手機(jī)號(hào)
    • 驗(yàn)證碼
    關(guān)于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡(jiǎn)要咨詢 | 簡(jiǎn)要咨詢須知 | 新媒體/短視頻平臺(tái) | 手機(jī)站點(diǎn) | 投訴建議
    工業(yè)和信息化部備案號(hào):滇ICP備2023014141號(hào)-1 云南省教育廳備案號(hào):云教ICP備0901021 滇公網(wǎng)安備53010202001879號(hào) 人力資源服務(wù)許可證:(云)人服證字(2023)第0102001523號(hào)
    云南網(wǎng)警備案專用圖標(biāo)
    聯(lián)系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關(guān)注公眾號(hào):hfpxwx
    咨詢QQ:1093837350(9:00—18:00)版權(quán)所有:易賢網(wǎng)
    云南網(wǎng)警報(bào)警專用圖標(biāo)