?
Solved

PHP SSL Socket Fgets Blocking

Posted on 2011-03-20
2
Medium Priority
?
559 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 16

Accepted Solution

by:
hankknight earned 1500 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

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…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
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…
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.
Suggested Courses

743 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