Warning: file_get_contents(): Filename cannot be empty
| From: | hadi | Date: | Mon, 09 Mar 2015 07:06:41 +0000 |
| Subject: | Warning: file_get_contents(): Filename cannot be empty | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-324595@lists.php.net to get a copy of this message | ||
Hi every one,
Im getting error while using file_get_contents(): function.
(Warning: file_get_contents(): Filename cannot be empty)
Im using file_get_contents(): function to get urls links from ($convert)
variable.
Here is my code
<?php
error_reporting(E_ALL);
ini_set("display_errors", 1);
$url = "http://www.sahafah.net/rss.php";
$rss = file_get_contents($url);
ini_set('mbstring.substitute_character', "none");
$rss1= mb_convert_encoding($rss, 'UTF-8', 'UTF-8');
$rss3 = simplexml_load_string($rss1);
if($rss3)
{
$items = $rss3->channel->item;
foreach($items as $item)
{
$title = $item->title;
$link = $item->link;
$published_on = $item->pubDate;
$description = $item->description;
$category = $item->category;
$guid = $item->guid;
$string2 = $item->description;
preg_match('/http.*.jpg/',$string2,$match2);
$convert = implode(",", $match2);
// A few settings
// Read image path, convert to base64 encoding
$imageData = base64_encode(file_get_contents($convert));
// Format the image SRC: data:{mime};base64,{data};
$src = 'data: '.exif_imagetype($convert).';base64,'.$imageData;
// Echo out a sample image
echo '<img src="', $src, '">';
}
}
?>