Iryk Posted June 21, 2006 Share Posted June 21, 2006 [code]<?php //featured game //initiate curl $ch = curl_init(); //give curl the url to visit curl_setopt($ch, CURLOPT_URL,"http://www.neopets.com/weather.phtml"); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); //load the page into a variable $result=curl_exec ($ch); //close the connection curl_close ($ch);//split each line into a value in an array $lines = explode("\n", $result); //cycle through each line in the array until we find a specific pattern foreach ($lines as $line_num => $line) { //get image and url $pattern = 'Average temperature today is \<b>([^\']*)\<\/b> degrees C (\<b>([^\']*)\<\/b> degrees F)\<p>\<center>\<img src=\'([^\']*)\' width=150 height=150 border=0>/';if (preg_match($pattern, $line, $matches)) { $temp = $matches[1]; $image = $matches[3];}}echo "$temp° C<br><img src='$image'>";?>[/code]What am i doing wrong here is the url to the page:[a href=\"http://majestic-neo.com/v.3/portal/\" target=\"_blank\"]http://majestic-neo.com/v.3/portal/[/a]Error:Warning: preg_match() [function.preg-match]: Delimiter must not be alphanumeric or backslash in /fpgs/fpgshttpd/majestic-neo/v.3/portal/weather.php on line 20 Link to comment https://forums.phpfreaks.com/topic/12516-curl-scripting-error/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.