fsockopen SSL warning

$handle = fsockopen("ssl://www.google.com", 443, $errno, $errstr, 30);
   fwrite($handle, $header);
   while (!feof($handle)) {
        $data .= fgets($handle, 128);
echo $data;

When I run it I get my data plus this:

Warning: fgets() [function.fgets]: SSL: fatal protocol error in V:\Web Server\xampp\htdocs\things\ava.php on line 60
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mnb93Author Commented:
Well if I do this:

  $data .= @fgets($handle, 128);

It suppresses it, however I would like to know what is causing it and how to stop it.
please do an echo $errno, $errstr and give it here so we can help you out.

putting an @ in front of a function will by default suppress its error messages.
however, they are still there; are you getting anything in your $data array ?
mnb93Author Commented:
I get data in my array;

$errno: 0
$errstr: (nothing)

Also I only get the warning if I don't supress it, I belive that it is probably a bug in PHP?
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

i did some research on this problem and it seems to be either your or the receiving webserver its SSL isn't property configured.

if all your data is available to you and there is nothing in $errno and/or $errstr, then you are probably good for now.
you might wanna give a heads-up to your or the receiving webservers' server administrator to tell them that they should check their SSL settings.

in the meantime, you could and should indeed suppress the error with the @ and not care anymore.
mnb93Author Commented:
Could I have some links to your research, please?
(By I am not using IIS... good old Apache!)
In my experience, I also encountered this problem when I'm building my own web server (with apache too). This is definitely not an error, as you find it out by yourself ($errno = 0). I have checked details of php.ini, but nothing can help except suppressing ALL warnings:

error_reporting  =  E_ALL & ~E_WARNING & ~E_NOTICE & ...

Sacrificing other warnings, I think that it is not a proper way to do so.

The source of the problem should come from the source code, yet I am not an expert on debugging. I think the only solution is to compile it again yourself, with the "debugged" version of course. The information here maybe useful for you:


If you think this is too troublesome, I would suggest you to suppress the message by @. This maybe the best way around.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.