php公众号链接提取文章标题、封面图、摘要、作者、公众号名称、简介、微信号、正文

方法很简单,就是一段段截取就行,虽然很傻瓜,但是能实现就行。

")-3); //公众号文章摘要

$str_14 = substr($result,0,strrpos($result,"og:title")-27);
$str_15 = substr($str_14,strripos($str_14,"author")+17); //公众号文章作者

$str_16 = substr($result,strripos($result,"div class="rich_media_content")+76);
$str_17 = substr($str_16,0,strrpos($str_16,"first_sceen__time")-75); //公众号文章正文

$gzhmsg = array(
    "公众号名称" => $str_2,
    "微信号" => $str_4,
    "公众号简介" => $str_6,
    "文章标题" => $str_8,
    "文章封面图" => $str_10,
    "文章摘要" => $str_13,
    "文章作者" => $str_15,
    "正文" => $str_17
);

//关闭请求
curl_close($ch);

// 输出JSON
echo json_encode($gzhmsg,JSON_UNESCAPED_UNICODE);
?>

Author:TANKING
Date:2020-10-24
Web:http://www.likeyun.cn/
WeChat:face6009

你可能感兴趣的:(php,公众号,正则表达式,提取内容,微信公众平台)