residual Posted June 30, 2008 Share Posted June 30, 2008 $ch = curl_init(); $timeout = 5; curl_setopt ($ch, CURLOPT_URL, 'http://www.bungie.net/Stats/GameStatsHalo3.aspx?gameid=582493375'); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout); $in = curl_exec($ch); curl_close($ch); preg_match('#<div class="community_colB" >(.+?)<!-- bottom -->#',$in, $skill); $skill1 = $skill[1]; echo $skill1; It echo's nothing. Why? I know the curl is correct it must be something with my expression but I can't figure out what, please help. Link to comment https://forums.phpfreaks.com/topic/112621-solved-preg-match-expression/ Share on other sites More sharing options...
rhodesa Posted June 30, 2008 Share Posted June 30, 2008 couldn't get preg to work for some reason...but accomplished the same thing with: <?php $ch = curl_init(); $timeout = 5; curl_setopt ($ch, CURLOPT_URL, 'http://www.bungie.net/Stats/GameStatsHalo3.aspx?gameid=582493375'); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout); $in = curl_exec($ch); curl_close($ch); $s = strpos($in,'<div class="community_colB" >'); $e = strpos($in,'<!-- bottom -->',$s); if($s && $e) print substr($in,$s+strlen('<div class="community_colB" >'),$e-$s); ?> Link to comment https://forums.phpfreaks.com/topic/112621-solved-preg-match-expression/#findComment-578440 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.