Solved

PHP SSL Socket Fgets Blocking

Posted on 2011-03-20
2
535 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
Comment Utility
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
Comment Utility
Solved problem. Error was somewhere else
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

772 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

9 Experts available now in Live!

Get 1:1 Help Now