src/Request/CurlRequestUtil.php
public function recursivePostRequest(int $maxRecursionCount, callable $callback, string $url, array $requestHeaders = [], array $post = [], bool $returnResponseHeaders = false)
    {
        $i = 0;
        $terminate = false;
        $result = null;

        while ($i++ < $maxRecursionCount && !$terminate) {
            $result = $this->postRequest($url, $requestHeaders, $post, $returnResponseHeaders);

            $terminate = $callback($result, $url, $requestHeaders, $post, $returnResponseHeaders, $maxRecursionCount, $i);
        }

        return $result;
    }
public function recursivePostRequest(int $maxRecursionCount, callable $callback, string $url, array $requestHeaders = [], array $post = [], bool $returnResponseHeaders = false)
    {
        $i = 0;
        $terminate = false;
        $result = null;

        while ($i++ < $maxRecursionCount && !$terminate) {
            $result = $this->postRequest($url, $requestHeaders, $post, $returnResponseHeaders);

            $terminate = $callback($result, $url, $requestHeaders, $post, $returnResponseHeaders, $maxRecursionCount, $i);
        }

        return $result;
    }
public function recursivePostRequest ( int $ maxRecursionCount , callable $ callback , string $ url , array $ requestHeaders = [ ] , array $ post = [ ] , bool $ returnResponseHeaders = false ) { $ i = 0 ; $ terminate = false ; $ result = null ; while ( $ i ++ < $ maxRecursionCount && ! $ terminate ) { $ result = $ this -> postRequest ( $ url , $ requestHeaders , $ post , $ returnResponseHeaders ) ; $ terminate = $ callback ( $ result , $ url , $ requestHeaders , $ post , $ returnResponseHeaders , $ maxRecursionCount , $ i ) ; } return $ result ; }
Recursivly send post request and terminates if termination condition is given or max request count is reached.

@param int      $maxRecursionCount
@param callable $callback
@param string   $url
@param array    $requestHeaders
@param array    $post
@param bool     $returnResponseHeaders

@return array|mixed|null
Recursivly send post request and terminates if termination condition is given or max request count is reached .