Solved

PHP SSL Socket Fgets Blocking

Posted on 2011-03-20
2
551 Views
Last Modified: 2012-05-11
Hi

I have PHP SSL socket open using fsockopen("ssl://mysite.com") etc.

Then I have this:

$this->header = fgets($fh, 1024);

I added showing runtime code above and below of this line and there is a lot of difference and this code causes error.

Before:
0.71457600 1300632013
After that line:
0.29207500 1300632254

These 2 values are output of microtime

How can I make my code not to wait for fgets if there is no 1024 byte available to read?

Please advice

Thanks
0
Comment
Question by:CSecurity
2 Comments
 
LVL 16

Accepted Solution

by:
hankknight earned 500 total points
ID: 35278527
Your idea cannot be implemented with fgets.  Consider using cURL instead of fgets.  The level of customization and control is much greater with cURL than it is with fgets.

http://php.net/manual/en/book.curl.php
0
 
LVL 17

Author Closing Comment

by:CSecurity
ID: 35813860
Solved problem. Error was somewhere else
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

685 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