我想根据 div 的类从 url 中提取数据。我正在使用这段代码
<?php
$doc = new DomDocument;
$doc->Load('http://placement.freshersworld.com/placement-papers/3i-Infotech/Placement- Paper-Whole-Testpaper-18433/');
$doc->getElementsByClassName('company-contentdetailes');
echo $doc;
?>
但我没有得到任何输出。我想使用数组以及一页中可能有 3-4 个类,我想提取类 company-contentdetailes 的所有数据
当我执行这个脚本时,我的错误日志中出现了很多错误
[09-Sep-2012 04:55:45 UTC] PHP Warning: DOMDocument::load() [<a href='domdocument.load'>domdocument.load</a>]: Opening and ending tag mismatch: link line 143 and head in http://placement.freshersworld.com/placement-papers/3i-Infotech/Placement-Paper-Whole-Testpaper-18433/, line: 144 in /home/xxxxxxxxx/xxxxxx/test3.php on line 3
[09-Sep-2012 04:55:46 UTC] PHP Warning: DOMDocument::load() [<a href='domdocument.load'>domdocument.load</a>]: EntityRef: expecting ';' in http://placement.freshersworld.com/placement-papers/3i-Infotech/Placement-Paper-Whole-Testpaper-18433/, line: 236 in /home/xxxxxxxxxx/xxxxxxx/test3.php on line 3
[09-Sep-2012 04:55:46 UTC] PHP Warning: DOMDocument::load() [<a href='domdocument.load'>domdocument.load</a>]: EntityRef: expecting ';' in http://placement.freshersworld.com/placement-papers/3i-Infotech/Placement-Paper-Whole-Testpaper-18433/, line: 236 in /home/xxxxxxxxxx/test3.php on line 3
[09-Sep-2012 04:55:46 UTC] PHP Warning: DOMDocument::load() [<a href='domdocument.load'>domdocument.load</a>]: EntityRef: expecting ';' in http://placement.freshersworld.com/placement-papers/3i-Infotech/Placement-Paper-Whole-Testpaper-18433/, line: 236 in /
很快...