Get Method

@param  string $data Data to be encoded
@param  string $verb URL segment to call - either 'geocode' or 'parse'
@return Stanley\Geocodio\Data
422195
public function get($data, $fields = [], $key = null, $verb = 'geocode')
    {
        if ($key) $this->apiKey = $key;
        $request = $this->getRequest($data, $fields, $verb);
        return $this->newDataObject($request->getBody());
    }
45883
public function get($url, $data = []) {
        if (!empty($data)) {
            if (is_array($data)) {
                $data = http_build_query($data);
            }
            if (strpos($url, '?') !== false) {
                $url .= '&' . $data;
            }
            else {
                $url .= '?' . $data;
            }
        }

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);

        $this->_parse_result($ch);

        $content = curl_exec($ch);
        curl_close($ch);

        if ($this->handle_referer) {
            $this->referer = $url;
        }

        return $this->_parse_result($content);
    }
1239202
protected function _translateCommandMethod($verb) {
        $command = str_replace('_', '.', $verb);
        switch ($this->getVersion()) {
            case '2.1':
                $command = str_replace('ban', 'purge', $command);
                break;
            case '4.1':
            case '4.0':
            case '3.0':
                $command = str_replace('purge', 'ban', $command);
                break;
            default:
                Mage::throwException('Unrecognized Varnish version: '.
                    $this->_version);
        }
        return $command;
    }
1340235
public function get($data = [])
	{
		// Process data given.
		$processPayload = $this->process(__FUNCTION__, $data);

		if( ! $processPayload->isStatus(Payload::STATUS_VALID))
		{
			return $processPayload;
		}

		// Get a properly formatted Entity Class string.
		$entityContext = $this->formatEntityType($processPayload->getData()['entity_type']);

		return $this->aggregate[$entityContext]->get($processPayload->getData()['filter'], $processPayload->getData()['sort'], $processPayload->getData()['field'], $processPayload->getData()['embed']);
	}
425286
protected function synchronousExecute($method, $verb, array $data = [])
    {
        $request = new Request($method, $verb, [], $this->serialize($data));

        $response = $this->client->send($request);
        return $response;
    }
1242401
protected function sendApiCall($verb, $location)
    {
        try {
            return parent::sendApiCall($verb, $location);
        } catch (EntityException $exception) {
            if (BackupCode\Exception::isBackupCodeException($exception)) {
                throw new BackupCode\Exception($exception);
            }

            throw $exception;
        }
    }
1040061
public function get($url, $data = array())
    {
        if (!empty($data)) {
            $url = $url . "?" . http_build_query($data);
        }
        $request = $this->webclient->createRequest('GET', $url);
        return $this->sendRequest($request);
    }
895930
public function addVerb($verb) {
      if (is_array($verb)) {
        $verb = BaMLVerbResource::Make($verb);
      }
          
      if (!($verb instanceof BaMLVerb)) {
        throw new \CatapultApiException("You can only add type BaMLVerb..");
      }
      /** check for constraints **/
      if (isset($this->constraints['verbs']) && sizeof($this->verbs) >= $this->constraints['verbs']) {
        throw new \CatapultApiException($this->getName() . " verb can only take " . $this->constraints['verbs'] . " verbs");
      }
      /** avoid memory issues by cloning. if needed **/
      if (BaseUtilities::is_ref($verb, $this)) {
        $this->verbs[] = clone $verb;
      } else {
        $this->verbs[] = $verb;
      }
    }
1021133
public function dispatch($verb = 'GET')
    {
        $request = Request::create($this->uri, $verb, $this->parameters);

        // Set token authorization header
        $request->headers->set('Authorization', 'Token token="' . config('forum.api.token') . '"');

        // Replace the request input for the duration of the dispatched request
        $input = $this->currentRequest->input();
        $this->currentRequest->replace($request->input());
        $response = Route::dispatch($request);
        $this->currentRequest->replace($input);

        return $this->receiver->handleResponse($request, $response);
    }
986577
protected function request(string $verb, string $uri, array $payload = [])
    {
        $response = $this->client->request($verb, $uri,
            empty($payload) ? [] : ['json' => $payload]
        );

        if (! in_array($response->getStatusCode(), [200, 201, 204])) {
            return $this->handleRequestError($response);
        }

        $responseBody = (string) $response->getBody();

        return json_decode($responseBody, true) ?: $responseBody;
    }
715437
protected function getResponse($verb, $resource, array $data = array())
    {
        $dispatcher = new RequestDispatcher();
        $request = new Request($resource);

        $this->setRequestHeaders($request);

        $this->prepareRequest($verb, $data, $request);

        $dispatcher->add($request);
        $dispatcher->execute();

        $responses = $this->getRequestContent($dispatcher);

        $this->checkResponseForErrors($responses);

        return json_decode($responses[0]->getContent());
    }
409456
public function call($verb, $endpoint, $options = [])
    {
        if ($this->validMethod($verb)) {
            // Get the headers and body from the options.
            $headers = isset($options['headers']) ? $options['headers'] : [];
            $body = isset($options['body']) ? $options['body'] : null;
            $pv = isset($options['protocol_version']) ? $options['protocol_version'] : '1.1';
            // Make the request.
            $request = new Request($verb, $endpoint, $headers, $body, $pv);
            // Save the request as the last request.
            $this->last_request = $request;
            // Send it.
            $response = $this->client->send($request, $options);
            if ($response instanceof ResponseInterface) {
                // Set the last response.
                $this->last_response = $response;
                // If the caller wants the raw response, give it to them.
                if (isset($options['parse_response']) && $options['parse_response'] === false) {
                    return $response;
                }
                $parsed_response = $this->parseResponse($response);
                return $parsed_response;
            } else {
                // This only really happens when the network is interrupted.
                throw new BadResponseException('A bad response was received.',
                    $request);
            }
        } else {
            throw new \Exception('Unrecognised HTTP verb.');
        }
    }
150011
public function sendRequest($verb, $location, $fields)
    {
        $curl = curl_init();

        curl_setopt($curl, CURLOPT_URL, $this->getUrl($location));
        curl_setopt($curl, CURLOPT_USERPWD, self::API_USERNAME . ":" . $this->secret);
        curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $verb);
        curl_setopt($curl, CURLOPT_USERAGENT, $this->getUserAgent());
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2);
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true);

        $requestHeaders = array(
            'Accept: application/json',
            'Content-Type: application/json',
        );

        if ($fields) {
            $data = json_encode($fields);
            curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
            $requestHeaders[] = 'Content-Length: ' . strlen($data);
        }

        curl_setopt($curl, CURLOPT_HTTPHEADER, $requestHeaders);

        $body = curl_exec($curl);
        $statusCode = (int) curl_getinfo($curl, CURLINFO_HTTP_CODE);

        if (curl_errno($curl) === 0) {
            return $this->generateResponse($statusCode, $body);
        } else {
            throw new Exception('Error while sending request to api: ' . curl_error($curl), Exception::SERVER_UNAVAILABLE, new Response($body, $statusCode));
        }
    }
788599
public function methodIs($verb)
    {

        $method = $this->getVerb();
        $return = ($method === strtolower($verb)) ? true : false;

        return $return;
    }
516590
protected function httpRequest($method, $data)
    {
        $url  = $this->getEndpoint($method);
        $body = http_build_query($data);

        $headers = [
            'Content-Type' => 'application/x-www-form-urlencoded'
        ];

        $response = $this->httpClient->request('POST', $url, $headers, $body)->getBody();

        $payload  = StringUtil::parseFuckStr($response);

        return $payload;
    }
435264
public function getMethodData(ReflectionMethod $method, $prefix)
    {
        $verb = $this->getVerb($name = $method->name);
        $uri = $this->addUriWildcards($plain = $this->getPlainUri($name, $prefix));
        return compact('verb', 'plain', 'uri');
    }
1168089
protected static function make($verb, $urls, $data, callable $callback = null)
    {
        if (!is_array($urls)) {
            $urls = [$urls => $data];
        } elseif (!(bool)count(array_filter(array_keys($urls), 'is_string'))) {
            foreach ($urls as $key => $url) {
                $urls[$url] = null;
                unset($urls[$key]);
            }
        }

        $dispatcher = new Dispatcher;
        $requests   = [];
        $dataStore  = [];

        foreach ($urls as $url => $data) {
            $requests[]  = new Request($url);
            $dataStore[] = $data;
        }

        new static($verb, $dispatcher, $requests, $dataStore, $callback);

        $requests  = $dispatcher->all();
        $responses = [];

        foreach ($requests as $request) {
            $responses[] = $request->getResponse();
        }

        return $responses;
    }