LMSouq
php-dev Open

How can I handle the warning of file_get_contents() function in PHP?

WA
Waseem
1 month ago
3 views
Problem Description
I wrote a PHP code like this $site="http://www.google.com"; $content = file_get_content($site); echo $content; But when I remove "http://" from `$site` I get the following warning: > Warning: > file_get_contents(www.google.com) > [function.file-get-contents]: failed > to open stream: I tried `try` and `catch` but it didn't work.

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base