<?php
//取div class="fraction-dl"的内容
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, ‘http://www.singtec.cn/xiezuo/1517195608.html‘); ?
curl_setopt($ch, CURLOPT_POST, 1); ?
curl_setopt( $ch, CURLOPT_HEADER, 0 ); ?
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); ?
curl_setopt( $ch, CURLOPT_POSTFIELDS, $data ); ?
$return = curl_exec( $ch ); ?
curl_close( $ch ); ?
$regex4="/<div class=\"fraction-dl\".*?>.*?<\/div>/ism"; ?
if(preg_match_all($regex4, $return, $matches)){ ?
??print_r($matches[0]); ?
}else{ ?
??echo ‘错误!‘; ?
}
?>
php获取指定div内容
原文地址:https://www.cnblogs.com/beli/p/8664306.html