Answer the question
In order to leave comments, you need to log in
Why doesn't cURL work with CURLOPT_RETURNTRANSFER?
I receive data from the server via api via curl. Parameters are passed via GET.
The server returns an array of records in json format.
But I ran into a problem, the query only works up to a certain number of records. Let's say if I request 20 records, then the request normally fulfills, but if I request 50 records, then the request returns null.
This happens when the CURLOPT_RETURNTRANSFER parameter is set to true , if it is not set, then the request is processed normally.
Why so?
curl:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($ch);
if (curl_errno($ch)) {
$data = curl_error($ch);
}
curl_close($ch);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question