php - 必应图片的url参数?
问题描述
我正在尝试通过 php 解析 bing 的 url 图像。我有这个结果
{
"3": {
"big": "https:\/\/i.ytimg.com\/vi\/lk634G2E4VY\/maxresdefault.jpg",
"thumb": "https:\/\/tse1.mm.bing.net\/th\/id\/OIP.8YesMNHKw0ytre_fF1ffTgHaEK?w=230&h=170&rs=1&pcl=dddddd&o=5&pid=1.1"
},
...
"20": {
"big": "http:\/\/www.sbs.com.au\/news\/sites\/sbs.com.au.news\/files\/mumbai_slum_fire_131122_getty_0.JPG",
"thumb": "https:\/\/tse1.mm.bing.net\/th\/id\/OIP.y3cTxPY2MMYQfM7v30hexQHaEg?w=230&h=170&rs=1&pcl=dddddd&o=5&pid=1.1"
}
}
我在 php 中使用我的函数与 simple_html * https://simplehtmldom.sourceforge.io/ *
function bingimages($search)
{
require_once('framick/parser/simple_html_dom.php');
$html = file_get_html('https://www.bing.com/images/search?q=' . $search);
$ret = $html->find('a');
foreach ($html->find('a') as $value) {
$parent = $value->parent();
if (isset($value->find('img')[0])) {
$res[] = array('big' => $value->href, 'thumb' => $value->find('img')[0]->src);
}
}
$res = array_reverse($res);
unset($res[0]);
$res = array_reverse($res);
unset($res[0]); //for remove img of bing
unset($res[1]);
unset($res[2]);
return json_encode($res);
}
我有 15 个结果。但我想要另一个结果。你有解决方案吗?url 中的参数?...感谢您的想法
解决方案
推荐阅读
- javascript - Onclick 功能在外部 javascript 文件中不起作用
- python - 如何在与另一个与其他模型具有多对多关系的应用程序上向用户添加评论?
- javascript - 如何避免在javascript中生成重复的html代码
- php - 关于 ORDER BY 使用 Prepared Statements 的两个问题
- c - 为什么不能在 GNU C 基本内联 asm 语句中使用局部变量?
- regex - 带有可选子组的 RegEx 可选组
- c# - 如何在本地调用另一个函数应用程序?
- python - AssertionError: 字段 '' 已在序列化程序 '' 上声明,但尚未包含在 'fields' 选项中。可选的
- r - R传单 - 防止map_marker_click在某个图层上但允许标签
- typescript - 在 TypeScript 中,有没有办法省略真假类型?