찾다

phpQQ登陆

May 25, 2016 pm 05:10 PM

代码

class qq {

    public $sid;
    public $http;
    public $qq_num;

    function __construct() {
        $this->http = new http_no_cookie;
    }

    function login($qq_num, $qq_pwd) {
       echo  $data = $this->http->get("http://pt.3g.qq.com/");
        $action = preg_match("/action=\"(.+)?\"/", $data, $matches);
        $action = $matches[1];
        $params = array();
        $params["login_url"] = "http://pt.3g.qq.com/s?aid=nLogin";
        $params["sidtype"] = 1;
        $params["loginTitle"] = "手机腾讯网";
        $params["bid"] = 0;
        $params["qq"] = $qq_num;
        $params["pwd"] = $qq_pwd;
        $params["loginType"] =1;
        echo $data = $this->http->post($action, http_build_query($params));
		if(preg_match("/http:\/\/vc.gtimg.com\//",$data,$matches)){
			echo "需要输入验证码";
			return 0;
			exit;
		}

		if(preg_match("/密码错误/",$data,$matches)){
		    echo "密码错误";
			return 1;
			exit;
		}
        $action = preg_match("/sid=(.+?)&/", $data, $matches);
        $this->sid = $matches[1];
		return $this->sid;
    }

    function sendMsg($to_num, $msg, $sid = 0) {
        $sid = $sid ? $sid : $this->sid;
        if (!$sid)
            exit("sid值未传入进去");
        $params = array();
        $params["msg"] = $msg;
        $params["u"] = $to_num;
        $params["saveURL"] = 0;
        $params["do"] = "send";
        $params["on"] = 1;
        $params["aid"] = "发送";
        $url = "http://q16.3g.qq.com/g/s?sid=" . $sid;
        echo $data = $this->http->post($url, http_build_query($params));
		return $data;
    }

    function getMsg($qq_num = 0, $sid = 0) {
        $qq_num = $qq_num ? $qq_num : $this->qq_num;
        if (!$qq_num)
            exit("qq_num值未传入进去");
	    $sid = $sid ? $sid : $this->sid;
        if (!$sid)
            exit("sid值未传入进去");
        $url = "http://q16.3g.qq.com/g/s?sid=" . $sid . "&3G_UIN=" . $qq_num . "&saveURL=0&aid=nqqChat";
        $data = $this->http->get($url);
        preg_match("/name=\"u\" value=\"(\d+)\"/", $data, $matches);
        $result["qq"] = $matches[1];
        $data = explode("<form", $data);
        $data = $data[0];
        preg_match_all("/<p>(.+)?<\/p>/", $data, $matches);
        unset($matches[1][0]);
        $result["content"] = $matches[1];
        return $result;
    }
	function logout($sid){
		$url="http://pt.3g.qq.com/s?sid=".$sid."&aid=nLogout";
		echo $url;
		echo $this->http->get($url);
	}
	function getFriendsList($qq_num = 0, $sid = 0){
	    $result=array();

		$qq_num = $qq_num ? $qq_num : $this->qq_num;
        if (!$qq_num)
            exit("qq_num值未传入进去");
        $sid = $sid ? $sid : $this->sid;
        if (!$sid)
            exit("sid值未传入进去");
		$url="http://q16.3g.qq.com/g/s?aid=nqqchatMain&sid=".$sid."&myqq=".$qq_num;
		while(true){
	    $i=1;
		$url.="&p=".$i;
		$data=$this->http->get($url);
		preg_match_all("/u=(.+?)&/",$data,$matches);
		foreach($matches[1] as $key=>$value){
			$result[]=$value;
		}
		if(count($matches[1])<13)
			break;
		$i++;
	   }
	   return $result;
	}
}

2. http.class.php

<?php
class http {
    private $curl;
    public $user_agent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.2.149.29 Safari/525.13";
     
    public function get($url) {
        $this->curl = curl_init();
        curl_setopt($this->curl, CURLOPT_CONNECTTIMEOUT, 20);
        curl_setopt($this->curl, CURLOPT_URL, $url);
        curl_setopt($this->curl, CURLOPT_HEADER, 1);
        curl_setopt($this->curl, CURLOPT_USERAGENT, $this->user_agent);
        curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, 1);
        $data = curl_exec($this->curl);
        curl_close($this->curl);
        return $data;
    }
    public function post($url, $params) {
        $this->curl = curl_init();
        curl_setopt($this->curl, CURLOPT_CONNECTTIMEOUT, 20);
        curl_setopt($this->curl, CURLOPT_URL, $url);
        curl_setopt($this->curl, CURLOPT_HEADER, 1);
        //curl_setopt($this->curl, CURLOPT_FOLLOWLOCATION, true);
        curl_setopt($this->curl, CURLOPT_POST, 1);
        curl_setopt($this->curl, CURLOPT_USERAGENT, $this->user_agent);
        curl_setopt($this->curl, CURLOPT_POSTFIELDS, $params);
        curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, 1);
        $data = curl_exec($this->curl);
        curl_close($this->curl);
        return $data;
    }
}
?>
성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.

핫 AI 도구

Undresser.AI Undress

Undresser.AI Undress

사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover

AI Clothes Remover

사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool

Undress AI Tool

무료로 이미지를 벗다

Clothoff.io

Clothoff.io

AI 옷 제거제

AI Hentai Generator

AI Hentai Generator

AI Hentai를 무료로 생성하십시오.

인기 기사

R.E.P.O. 에너지 결정과 그들이하는 일 (노란색 크리스탈)
3 몇 주 전By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. 최고의 그래픽 설정
3 몇 주 전By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. 아무도들을 수없는 경우 오디오를 수정하는 방법
3 몇 주 전By尊渡假赌尊渡假赌尊渡假赌
WWE 2K25 : Myrise에서 모든 것을 잠금 해제하는 방법
4 몇 주 전By尊渡假赌尊渡假赌尊渡假赌

뜨거운 도구

DVWA

DVWA

DVWA(Damn Vulnerable Web App)는 매우 취약한 PHP/MySQL 웹 애플리케이션입니다. 주요 목표는 보안 전문가가 법적 환경에서 자신의 기술과 도구를 테스트하고, 웹 개발자가 웹 응용 프로그램 보안 프로세스를 더 잘 이해할 수 있도록 돕고, 교사/학생이 교실 환경 웹 응용 프로그램에서 가르치고 배울 수 있도록 돕는 것입니다. 보안. DVWA의 목표는 다양한 난이도의 간단하고 간단한 인터페이스를 통해 가장 일반적인 웹 취약점 중 일부를 연습하는 것입니다. 이 소프트웨어는

에디트플러스 중국어 크랙 버전

에디트플러스 중국어 크랙 버전

작은 크기, 구문 강조, 코드 프롬프트 기능을 지원하지 않음

드림위버 CS6

드림위버 CS6

시각적 웹 개발 도구

맨티스BT

맨티스BT

Mantis는 제품 결함 추적을 돕기 위해 설계된 배포하기 쉬운 웹 기반 결함 추적 도구입니다. PHP, MySQL 및 웹 서버가 필요합니다. 데모 및 호스팅 서비스를 확인해 보세요.

안전한 시험 브라우저

안전한 시험 브라우저

안전한 시험 브라우저는 온라인 시험을 안전하게 치르기 위한 보안 브라우저 환경입니다. 이 소프트웨어는 모든 컴퓨터를 안전한 워크스테이션으로 바꿔줍니다. 이는 모든 유틸리티에 대한 액세스를 제어하고 학생들이 승인되지 않은 리소스를 사용하는 것을 방지합니다.