php网站调用api,php网站调用梦搏网络一键采集api示例

$url="http://api.sinmeng.net/api/caiji/caiji.php?url={$_GET[url]}&key=你的key";

$caiji=json_decode(file_get_contents($url));

$caiji_lead_image_url= $caiji->{'lead_image_url'};//图片

$caiji_word_count= $caiji->{'word_count'};//字数

$caiji_title= $caiji->{'title'};//标题

$caiji_content= $caiji->{'content'};//内容

$caiji_description = preg_replace("//si","",$caiji_content);//过滤html标签

$caiji_description = mb_substr($caiji_description,0,80,'utf-8');//简介

//以下内容是用在GBK编码网页,已经将UTF-8进行了转码。

//$caiji_lead_image_url= mb_convert_encoding($caiji->{'lead_image_url'},'gbk','utf-8');//图片

//$caiji_word_count= mb_convert_encoding($caiji->{'word_count'},'gbk','utf-8');//字数

//$caiji_title= mb_convert_encoding($caiji->{'title'},'gbk','utf-8');//标题

//$caiji_content= mb_convert_encoding($caiji->{'content'},'gbk','utf-8');//内容

//$caiji_description = preg_replace("//si","",$caiji_content);//过滤html标签

//$caiji_description = mb_substr($caiji_description,0,80,'gbk');//简介

网友 于 2018-10-27 10:32:25 发表评论

96ebdfeba3bc6186d79cfc973eb3af00.gif online casino real money

online casino slots

play casino games online

casino slots

slot game

你可能感兴趣的:(php网站调用api)