Re: Warning: file_get_contents(): Filename cannot be empty

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Mar 9, 2015 at 3:06 PM, hadi <almarzuki2011@xxxxxxxxxxx> wrote:

> 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);
>


I believe file_get_contents should be used on a local file and not remote
or over http


>
> 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, '">';
>
>
>
>
>
>
>
>
>
> }
>
>
> }
>
>
>
>
>
>
>
> ?>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Marcos | I love PHP, Linux, and Java
<http://javadevnotes.com/java-float-to-string-examples>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux