Warning: Bad arguments to implode()

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
edexly25
Forum Newbie
Posts: 1
Joined: Mon Apr 22, 2002 4:30 am

Warning: Bad arguments to implode()

Post by edexly25 »

hi all,

i need help fast.

the sportsnews script i have gives me this error;

Warning: file("http://www.sport4ever.net") - Success in /home/banner/public_html/sports.php on line 6

Warning: Bad arguments to implode() in /home/banner/public_html/sports.php on line 6

heres the script;

<?
$url = "http://www.sport4ever.net";
$target="_blank"; // (_balnk) to open in new window - () to open in the same window
$string = implode("
", file($url));
$string2 = explode("<!-- NP v3.7.5 -->", $string);
$string3 = explode("</td></tr></table>", $string2[1]);
$news = str_replace('href="news-world.shtml"',"href="$url/news-world.shtml" target="$target"".$url,$string3[0]);
echo "<span dir=rtl>".$news."</span>";
?>

thanks :)


ed
jason
Site Admin
Posts: 1767
Joined: Thu Apr 18, 2002 3:14 pm
Location: Montreal, CA
Contact:

Post by jason »

Make sure file() is actually returning something. You don't verify that it is. Capture its return value in a variable, and print_r() to see if you get something back.

Also, verify with is_array().
Post Reply