G
G
Georg2013-10-29 20:58:34
PHP
Georg, 2013-10-29 20:58:34

Problem with file_get_contents: failed to open stream: Operation now in progress

Good evening.
There was a problem when working with the Simple HTML DOM Parser library.
When working in multiple threads (I use habrahabr.ru/post/134501/ ), the following error occasionally occurs:

PHP Warning:  file_get_contents(http://example.com): failed to open stream: Operation now in progress in /vendor/libraries/simplehtmldom/simple_html_dom. php on line 75


As I understand it, the problem here is the simultaneous launch of this function in different threads. Solution to only rewrite this part of the library using CURL?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Masterme, 2013-10-29
@Masterme

For multi-threaded download - curl of course

A
Andrey Burov, 2013-10-29
@BuriK666

instead try using
file_get_contents('http://example.com',false,stream_context_create());

S
SkiF_TLT, 2013-10-30
@SkiF_TLT

Try using curl_multi_exec (and curl_multi_* in general ).
“Multithreading” is already implied there (specially indicated in quotation marks, because normal multithreading in PHP is still not implemented).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question