?
Solved

fsockopen SSL warning

Posted on 2006-04-06
6
Medium Priority
?
808 Views
Last Modified: 2008-02-01
$handle = fsockopen("ssl://www.google.com", 443, $errno, $errstr, 30);
   fwrite($handle, $header);
   while (!feof($handle)) {
        $data .= fgets($handle, 128);
   }
   fclose($handle);
   
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
0
Comment
Question by:mnb93
  • 3
  • 2
6 Comments
 
LVL 5

Author Comment

by:mnb93
ID: 16396881
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.
0
 
LVL 4

Expert Comment

by:AndyAelbrecht
ID: 16398670
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 ?
0
 
LVL 5

Author Comment

by:mnb93
ID: 16398820
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?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 4

Expert Comment

by:AndyAelbrecht
ID: 16398846
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.
0
 
LVL 5

Author Comment

by:mnb93
ID: 16399099
Could I have some links to your research, please?
(By I am not using IIS... good old Apache!)
0
 
LVL 1

Accepted Solution

by:
harrylau earned 2000 total points
ID: 16413968
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:

http://bugs.php.net/bug.php?id=34668&edit=1

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

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses
Course of the Month13 days, 23 hours left to enroll

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question