pagemarks/codes

php获取豆瓣电影的评分数据

Opened this issue · 0 comments

字符截取所需部分(demo)

$string =  Http::get('https://movie.douban.com/subject/30211998/');
$string = strstr($string ,'</head>',true);
$string = strstr($string, '<script type="application/ld+json">', false);
$string = str_replace('<script type="application/ld+json">', '', $string);
$json = trim(strstr($string, '</script>',true));
print_r(json_decode($json, 32));
exit;