https://bigfuture.collegeboard.org/college-university-search/dickinson-college
I was trying to fetch the content of this page using PHP's preg_match
function:
$filename = 'https://bigfuture.collegeboard.org/college-university-search/dickinson-college';
$content = file_get_contents($filename);
$subject = $content;
$pattern = '#(?<=<span class="locality" itemprop="addressLocality">)(\w*)(?=<\/span>)#';
preg_match($pattern,$subject,$city);
print_r($city);
The info that I want to fetch is within the div with class "clearfix margin60 marginBottomOnly".
When using Firebug or 'Inspect Element' in Chrome, the content within this div is visible. However when I viewed the page source, the div is empty.
Could anybody tell me the reason and how to get the content that I want from the page (for eg, the location of the school)?
您看不到它,因为内容是由JavaScript函数生成的,如果您将检查“脚本”选项卡并查找div名称[gwtDiv],那么您将生成什么脚本,
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.