src/V2/Receive/Receive.php
public function generate($key, $xpub, $callback, $gap_limit = null)
    {
        $p = compact('key', 'xpub', 'callback');
        if(!is_null($gap_limit))
            $p['gap_limit'] = $gap_limit;
        $q = http_build_query($p);

        curl_setopt($this->ch, CURLOPT_POST, false);
        curl_setopt($this->ch, CURLOPT_URL, static::URL.'?'.$q);

        if (($resp = curl_exec($this->ch)) === false) {
            throw new HttpError(curl_error($this->ch));
        }

        if (($data = json_decode($resp, true)) === NULL) {
            throw new Error("Unable to decode JSON response from Blockchain: $resp");
        }

        $info = curl_getinfo($this->ch);

        if ($info['http_code'] == 200) {
            return new ReceiveResponse($data['address'], $data['index'], $data['callback']);
        }

        throw new Error(implode(', ', $data));
    }
public function generate($key, $xpub, $callback, $gap_limit = null)
    {
        $p = compact('key', 'xpub', 'callback');
        if(!is_null($gap_limit))
            $p['gap_limit'] = $gap_limit;
        $q = http_build_query($p);

        curl_setopt($this->ch, CURLOPT_POST, false);
        curl_setopt($this->ch, CURLOPT_URL, static::URL.'?'.$q);

        if (($resp = curl_exec($this->ch)) === false) {
            throw new HttpError(curl_error($this->ch));
        }

        if (($data = json_decode($resp, true)) === NULL) {
            throw new Error("Unable to decode JSON response from Blockchain: $resp");
        }

        $info = curl_getinfo($this->ch);

        if ($info['http_code'] == 200) {
            return new ReceiveResponse($data['address'], $data['index'], $data['callback']);
        }

        throw new Error(implode(', ', $data));
    }
public function generate ( $ key , $ xpub , $ callback , $ gap_limit = null ) { $ p = compact ( 'key' , 'xpub' , 'callback' ) ; if ( ! is_null ( $ gap_limit ) ) $ p [ 'gap_limit' ] = $ gap_limit ; $ q = http_build_query ( $ p ) ; curl_setopt ( $ this -> ch , CURLOPT_POST , false ) ; curl_setopt ( $ this -> ch , CURLOPT_URL , static :: URL . '?' . $ q ) ; if ( ( $ resp = curl_exec ( $ this -> ch ) ) === false ) { throw new HttpError ( curl_error ( $ this -> ch ) ) ; } if ( ( $ data = json_decode ( $ resp , true ) ) === NULL ) { throw new Error ( "Unable to decode JSON response from Blockchain: $resp" ) ; } $ info = curl_getinfo ( $ this -> ch ) ; if ( $ info [ 'http_code' ] == 200 ) { return new ReceiveResponse ( $ data [ 'address' ] , $ data [ 'index' ] , $ data [ 'callback' ] ) ; } throw new Error ( implode ( ', ' , $ data ) ) ; }
Generates a receive adddress.

@param string $key The API key.
@param string $xpub The public key.
@param string $callback The callback URL.
@param int    $gap_limit How many unused addresses are allowed.
@return \Blockchain\V2\Receive\ReceiveResponse
@throws \Blockchain\Exception\Error
@throws \Blockchain\Exception\HttpError
Generates a receive adddress .