GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - ahonn/zhihu-php: zhihu web parser

This repository was archived by the owner on Jan 4, 2021. It is now read-only.
BranchesTags
Open more actions menu

Latest commit

 

History

98 Commits
98 Commits

Folders and files

NameName
Last commit message
Last commit date
test
test
 
 
zhihu
zhihu
 
 
.gitignore
.gitignore
 
 
ChangeLog.md
ChangeLog.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 

Repository files navigation

zhihu-php

介绍

zhihu-php 使用PHP编写,用于获取知乎上的各种信息。

本项目需要 PHP version >= 5.3 ,开启 CURL 扩展,使用 simple html dom 解析网页

根据 URL 生成对应的对象,例如知乎用户对象 User、知乎问题对象 Question、答案对象 Answer 等等。

准备

打开 zhihu.php,将知乎的 Cookie 复制黏贴到 COOKIE 的常量定义中:

const COOKIE = "your cookie";

简单样例

<?php
require_one 'zhihu/zhihu.php';

// 设置 URL
$question_url = 'https://www.zhihu.com/question/19550393';

// 实例化对象
$question = new Question($question_url);

// 获取该问题排名第一的答案
$answer = $question->top_answer();

// 获取该回答的答主
$author = $answer->author();

// 获取答案答主的信息
$about = $author->about();

// 输出答主基本信息
var_dump($about);

更新信息

Change Log

联系我

  • Email:[email protected]

About

zhihu web parser

Resources

Readme
MIT license
Activity

Stars

52 stars

Watchers

1 watching

Forks

11 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.