Added check if article was found
This commit is contained in:
parent
d7e9ab5822
commit
fbab351305
@ -9,6 +9,13 @@ if (!isset($argv[1]))
|
||||
$url = $argv[1];
|
||||
$data = shell_exec("curl -s $url");
|
||||
preg_match("/\<p\>(.*)\<\/p\>/", $data, $match);
|
||||
|
||||
if (!isset($match[1]))
|
||||
{
|
||||
print "No Wikipedia article found at that URL\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$string = strip_tags($match[1]);
|
||||
print (wordwrap($string, 60, "\n") . "\n");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user