RE: [PHP] Warning: file_get_contents(): Filename cannot be empty
| From: | hadi | Date: | Mon, 09 Mar 2015 11:06:10 +0000 |
| Subject: | RE: [PHP] Warning: file_get_contents(): Filename cannot be empty | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-324608@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Ashley Sheridan [mailto:ash@ashleysheridan.co.uk]
> Sent: Monday, March 09, 2015 1:17 PM
> To: hadi
> Cc: 'Marcos Almeida Azevedo'; 'PHP General'
> Subject: Re: [PHP] Warning: file_get_contents(): Filename cannot be empty
>
> On Mon, 2015-03-09 at 13:09 +0300, hadi wrote:
> >
> > > -----Original Message-----
> > > From: Ashley Sheridan [mailto:ash@ashleysheridan.co.uk]
> > > Sent: Monday, March 09, 2015 1:03 PM
> > > To: hadi
> > > Cc: 'Marcos Almeida Azevedo'; 'PHP General'
> > > Subject: Re: [PHP] Warning: file_get_contents(): Filename cannot be
> > > empty
> > >
> > >
> > > > > > >
> > > > > > > What happens when you debug your code? What does $convert
> > > contain?
> > > > > > > Is it a string containing a URL?
> > > > > > Yes it containing string full path of url of the image like
> > > > > > this
> > > > > > (http://www.alsahwa-yemen.net/pic_news/1/1_46777.jpg)
> > > > > >
> > > > > >
> > > > >
> > > > > Does it definitely contain only that? Because the error you're
> > > > > getting is saying that it isn't a valid URL string and is
> > > > > in-fact an empty string. Have you checked that every single time
> > > > > you're calling it there is actually a valid URL in that variable?
> > > >
> > > >
> > > > Yes Ash, I have checked that. It have valid url in the variable
> > > > $convert, you
> > > may try the code in ur system and see by ur self....
> > > >
> > >
> > > I'm not sure how you checked, but I checked and I count 8 instances
> > > of an empty string for $convert when I run your original code.
> > >
> > > The cause is that your regular expression is not always producing a
> > > match, so you're imploding on an empty array, creating an empty string.
> >
> > Thanking you Ash for checking my code.
> >
> > But what to do to fix this error....
Ash,
How did checked there's empty string, can you give me the code I want to check by myself.
Thanks