Solved

PHP SSL Socket Fgets Blocking

Posted on 2011-03-20
2
541 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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

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…
It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

863 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now