I have a function which gets data with an API request. I sending an array (called) $result
with that request. This array contains metadata of the actual data I am posting.
The problem is:
The array is too big to handle for the api request.
string(186) " invalid input too much data to parse out into domains "
So I thought of splitting up the array with this function:
echo ("<pre>");
print_r (smallify($result, 15));
echo ("<pre/>");
function smallify($arr, $numberOfSlices){
$sliceLength = sizeof($arr) / $numberOfSlices;
for($i=1; $i<=$numberOfSlices; $i++){
$arr1 = array_chunk($arr, $sliceLength*$i);
return $arr1;
unset($arr1);
}
}
And it works pretty well.
Now, how do I access the internal array indexes and assign them a variable so that I can loop through the api request for each chunk?
Here's the API request:
// The last parameter of the Domain is the the array.
// I want to make a request for every chunked array.
$domains = file_get_contents("http://www.somedomain.com/api.php?username:Pw:getinfo=$result");
var_dump($domains);