Questions tagged [curl-multi]

is refer to multiple synchronous curl transfers

197 questions
36
votes
4 answers

PHP Multiple Curl Requests

I'm currently using Curl for PHP a lot. It takes a lot of time to get results of about 100 pages each time. For every request i'm using code like this $ch = curl_init(); // get source curl_close($ch); What are my options to speed things up? How…
Simon
  • 5,464
  • 6
  • 49
  • 85
34
votes
1 answer

understanding php curl_multi_exec

I'm trying to understand curl_multi_exec. I've copied a piece of the manual example here. So I'm wondering, how does it work? The first loop sends the http request I guess? But it then it is followed by a loop inside a loop using functions with…
glennv
  • 703
  • 1
  • 9
  • 17
30
votes
5 answers

How to fix curl: (35) Cannot communicate securely with peer: no common encryption algorithm(s)

I am trying to access and download some .torrent files from https://torrage.com using php curl. But nothing happens , curl_error($ch) gives $ch = curl_init…
user1642018
15
votes
2 answers

Asynchronous HTTP requests in PHP

Is there any sane way to make a HTTP request asynchronously in PHP without throwing out the response? I.e., something similar to AJAX - the PHP script initiates the request, does it's own thing and later, when the response is received, a callback…
pilsetnieks
  • 10,330
  • 12
  • 48
  • 60
13
votes
6 answers

Faster alternative to file_get_contents()

Currently I'm using file_get_contents() to submit GET data to an array of sites, but upon execution of the page I get this error: Fatal error: Maximum execution time of 30 seconds exceeded All I really want the script to do is start loading the…
Rob
  • 7,980
  • 30
  • 75
  • 115
11
votes
4 answers

Pulling data from API, memory growth

I'm working on a project where I pull data (JSON) from an API. The problem I'm having is that the memory is slowly growing until I get the dreaded fatal error: Fatal error: Allowed memory size of * bytes exhausted (tried to allocate * bytes) in…
PHPhil
  • 1,555
  • 13
  • 27
11
votes
4 answers

Have to call curl_close() twice before handle is closed and cookie jar can be read. Is this a bug?

I've been banging my head against the wall for hours trying to understand why cURL's cookie jar file was empty when I tried reading it. I just discovered that my code works if I call curl_close() twice instead of once, however, and I'm wondering if…
Nate
  • 26,164
  • 34
  • 130
  • 214
11
votes
6 answers

PHP curl_multi_getcontent returns null

I have been following this tutorial on how to use curl_multi. http://arguments.callee.info/2010/02/21/multiple-curl-requests-with-php/ I can't tell what I am doing wrong, but curl_multi_getcontent is returning null. It is suppose to return JSON. I…
Blake Plumb
  • 6,779
  • 3
  • 33
  • 54
10
votes
2 answers

How to reliably reproduce curl_multi timeout while testing public proxies

Relevant information: issue 3602 on GitHub I'm working on a project that gathers and tests public/free proxies, and noticed that when I use the curl_multi interface for testing these proxies, sometimes I get many 28(timeout) errors. This never…
Accountant م
  • 6,975
  • 3
  • 41
  • 61
10
votes
1 answer

How can I use cURL to open multiple URLs simultaneously with PHP?

Here is my current code: $SQL = mysql_query("SELECT url FROM urls") or die(mysql_error()); //Query the urls table while($resultSet = mysql_fetch_array($SQL)){ //Put all the urls into one variable // Now for some cURL to run it. …
Rob
  • 7,980
  • 30
  • 75
  • 115
8
votes
6 answers

Get all the URLs using multi curl

I'm working on an app that gets all the URLs from an array of sites and displays it in array form or JSON. I can do it using for loop, the problem is the execution time when I tried 10 URLs it gives me an error saying exceeds maximum execution…
user123
  • 435
  • 1
  • 6
  • 23
6
votes
2 answers

curl_errno returns 0 instead of 6

$data_struct = array(); $data_struct[]['opts'] = array( CURLOPT_URL => 'http://www.yahoo.com/', CURLOPT_RETURNTRANSFER => true); $data_struct[]['opts'] = array( CURLOPT_URL => 'http://www.google.com/', CURLOPT_RETURNTRANSFER =>…
Phe Dev
  • 63
  • 1
  • 4
6
votes
4 answers

PHP cURL multi_exec delay between requests

If I run a standard cURL_multi_exec function (example below), I get all cURL handles requested at once. I would like to put a delay of 100ms between each request, is there a way to do that? (nothing found on Google & StackOverflow search) I've tried…
Edi Budimilic
  • 4,526
  • 3
  • 19
  • 22
6
votes
2 answers

php - multiple requests with curl (NOT 'multi-threaded')

If i want to do multiple things (that require cookies) with curl, for example: login to (my own) blog then automatically submit a blog post do I do this in one curl instance before curl close or do i close first session and then start second one…
Phil
  • 3,628
  • 8
  • 34
  • 36
6
votes
1 answer

How to know which URL failed in curl_multi_exec?

I wrote a class to make it easier to use multi cURL requests I want to log errors when I get a 404 error or any other error. I already have CURLOPT_FAILONERROR set to true. I'm currently using curl_multi_info_read(). and this is my code: $active =…
Pierre
  • 12,468
  • 6
  • 44
  • 63
1
2 3
13 14