【问题标题】:Using PHP simple dom parser with instagram使用带有 instagram 的 PHP 简单 dom 解析器
【发布时间】:2016-05-23 16:05:11
【问题描述】:

我正在尝试制作一个小工具,可以使用PHP simple dom parser 抓取 Instagram 帐户的图片。

但是,当我尝试使用解析器提取内容时,我得到一个空白页。有没有办法让它与 instagram 一起使用?

require 'simplehtmldom_1_5/simple_html_dom.php'; 


// Create DOM from URL or file
$html = file_get_html('https://www.instagram.com/techcrunch/');

// Find all images 
foreach($html->find('img') as $element) 
   echo $element->src . '<br>';

【问题讨论】:

标签: php parsing


【解决方案1】:

如果您查看https://www.instagram.com/techcrunch/ 的来源,您会发现其中没有&lt;img&gt; 标记。这些是稍后由 JavaScript 创建的。

使用official instagram APIs 可能是更好的选择。

alternatives,但它们有点hackish,可能随时停止工作。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-03-29
    • 2012-01-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-07-30
    • 2015-02-14
    相关资源
    最近更新 更多