Jump to content

Help with cURL error message


$php_mysql$

Recommended Posts

so im trying to display error message which is (Error!</font> Currently no updates available.) if nothing from the url returns but all i see is the error message when i try to check for error the data which is available does not show. why so?

 

function weather(){
$ch = curl_init("http://www.domain.com/weather.html");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
if(curl_errno($ch)){
$page = curl_exec($ch);
	preg_match('#<table[^>]*>(.+?)</table>#is', $page, $matches);
	foreach ($matches as &$match) {
		$match = $match;
	}
	echo '<table height=\"200px\">';
	echo $matches[1];
	echo '</table>';
}else{
echo "<table>";
echo "<tr>";
	echo "<td>";
		echo '<font align="center" color="red">Error!</font> Currently no updates available.';
	echo "</td>";
echo "</tr>";
echo "</table>";	
}
}

Link to comment
https://forums.phpfreaks.com/topic/246219-help-with-curl-error-message/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.