我有一个代码来读取表单中的所有输入。
该代码在我的演示页面和其他页面中有效,但在某些页面中不起作用。对于示例问题:
脸书:
$url = 'https://www.facebook.com';
$html = file_get_html($url);
$post = $html->find('form[id=reg]'); //id for the register facebook page
print_r($post);
打印一个空数组。
功能示例:
$url = 'http://www.monografias.com/usuario/registro';
$html = file_get_html($url);
$post = $html->find('form[name=myform]');
print_r($post);
打印表单内容
Facebook不会直接给你注册表,它只会用基本的html回复,其余的将使用javascript创建。 亲眼看看
$url = 'https://www.facebook.com';
$html = file_get_html($url);
echo htmlspecialchars($html);
他们发送给您的 HTML 中没有带有"reg"ID 的表单。
simple_html_dom.php包含一行限制它将解析的最大文件大小:
define('MAX_FILE_SIZE', 600000);
对于大于此大小的文件,file_get_html()
将只返回 false
.