This method returns a new Ripcord client, configured to access a Simple RPC server.
@param string $url
@param array $options Optional.
@return object
@see Ripcord_Client
191413
public static function simpleClient($url, $options = null, $transport = null) 
	{
		$options['version'] = 'simple';
		return self::client($url, $options, $transport);
	}
1065759
protected function executeRequest($url, array $options = array())
    {
        $ch = curl_init($url);

        foreach ($options as $name => $value) {
            if (!curl_setopt($ch, $name, $value)) {
                if ($this->logger) {
                    $this->logger->warning("Option could not be set to Curl: $name, value: $value");
                }
            }
        }

        // some options we have to force
        curl_setopt($ch, CURLOPT_FAILONERROR, true);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

        $results = curl_exec($ch);
        if ($results === false) {
            if ($this->logger) {
                $this->logger->error("Curl request failed: " . curl_error($ch));
            }
        }

        // close cURL resource, and free up system resources
        curl_close($ch);

        return $results;
    }
510318
public function makeRequest($url, $options = [], $parseResponse = true)
    {
        return $this->request($url, $options, $parseResponse, function ($url, $method, $headers, $data) {
            return $this->getHttpClient()->retrieveResponse($url, $data, $headers, $method);
        });
    }
239347
public function request($url, $options)
    {
        $this->url = $url;
        $this->options = array_replace_recursive($this->settings['defaults'], $options);

        try {
            return $this->handleRequest();
        } catch (TokenExpiredException $e) {
            $this->refresh();

            return $this->handleRequest();
        }
    }
965389
public function get($url, array $params = null, array $options = array())
	{
		return $this->request($url, 'GET', $params, $options);
	}
1300280
public function send(string $url, array $options = []): array
    {
        $response = $this->client->get($url, $options);

        $result = \GuzzleHttp\json_decode($response->getBody()->getContents(), true);
        if (!empty($result['Command']) && $result['Command'] === 'Unknown') {
            throw new UnknownCommandException('command is unknown');
        }

        return $result;
    }
1025859
protected function exec(Url $url, array $options)
    {
        $connection = curl_init((string) $url);
        curl_setopt_array($connection, $options);

        $curl = new CurlResult($connection);

        //Get only text responses
        $curl->onHeader(function ($name, $value, $data) {
            if ($name === 'content-type') {
                $data->isBinary = !preg_match('/(text|html|json)/', strtolower($value));
            }
        });

        $curl->onBody(function ($string, stdClass $data) {
            return empty($data->isBinary);
        });

        curl_exec($connection);

        $result = $curl->getResult();

        curl_close($connection);

        return $this->responses[] = new Response(
            $url,
            Url::create($result['url']),
            $result['statusCode'],
            $result['contentType'],
            $result['content'],
            $result['headers'],
            $result['info']
        );
    }
1325151
protected function executeCurl($url, array $options = array())
    {
        $session = curl_init($url);

        if (count($options)) {
            curl_setopt_array($session, $options);
        }

        $response = curl_exec($session);

        $error = false;
        $info = curl_getinfo($session);
        if ($response === false) {
            $error = curl_error($session);
        }

        curl_close($session);

        return array($response, $info, $error);
    }
1156013
protected function _curl($url,$options) {
		$curl=curl_init($url);
		curl_setopt($curl,CURLOPT_FOLLOWLOCATION,
			$options['follow_location']);
		curl_setopt($curl,CURLOPT_MAXREDIRS,
			$options['max_redirects']);
		curl_setopt($curl,CURLOPT_CUSTOMREQUEST,$options['method']);
		if (isset($options['header']))
			curl_setopt($curl,CURLOPT_HTTPHEADER,$options['header']);
		if (isset($options['content']))
			curl_setopt($curl,CURLOPT_POSTFIELDS,$options['content']);
		curl_setopt($curl,CURLOPT_ENCODING,'gzip,deflate');
		$timeout=isset($options['timeout'])?
			$options['timeout']:
			ini_get('default_socket_timeout');
		curl_setopt($curl,CURLOPT_CONNECTTIMEOUT,$timeout);
		curl_setopt($curl,CURLOPT_TIMEOUT,$timeout);
		$headers=array();
		curl_setopt($curl,CURLOPT_HEADERFUNCTION,
			// Callback for response headers
			function($curl,$line) use(&$headers) {
				if ($trim=trim($line))
					$headers[]=$trim;
				return strlen($line);
			}
		);
		curl_setopt($curl,CURLOPT_SSL_VERIFYPEER,FALSE);
		ob_start();
		curl_exec($curl);
		curl_close($curl);
		$body=ob_get_clean();
		return array(
			'body'=>$body,
			'headers'=>$headers,
			'engine'=>'cURL',
			'cached'=>FALSE
		);
	}
801986
public function loadFromUrl(string $url, array $options = [], CurlInterface $curl = null): Dom
    {
        if (is_null($curl)) {
            // use the default curl interface
            $curl = new Curl;
        }
        $content = $curl->get($url);

        return $this->loadStr($content, $options);
    }
541343
function RPCClient(options) {
  if (!(this instanceof RPCClient))
    return new RPCClient(options);

  if (!options)
    options = {};

  if (typeof options === 'string')
    options = { uri: options };

  this.options = options;
  this.network = Network.get(options.network);

  this.uri = options.uri || `http://localhost:${this.network.rpcPort}`;
  this.apiKey = options.apiKey;
  this.id = 0;
}
64305
public function request($url, array $options = array())
    {
        $options += array(
            'data' => null,
            'timeout' => 30,
            'context' => null,
            'method' => 'GET',
            'headers' => array()
        );

        if ($options['method'] === 'POST' && empty($options['headers'])) {
            $options['headers'] = array('Content-Type' => 'application/x-www-form-urlencoded');
        }

        if (!empty($options['query'])) {
            $url = strtok($url, '?') . '?' . http_build_query($options['query']);
        }

        return $this->setUri($url)
            ->setHeaders($options['headers'])
            ->setMethod($options['method'])
            ->setData($options['data'])
            ->setTimeOut($options['timeout'])
            ->setContext($options['context'])
            ->setSocket()
            ->exec()
            ->getFormattedResponse();
    }
92445
public function next($nextUrl, $options = [])
    {
        $url = $this->instanceURLRepo->get();
        $url .= $nextUrl;

        $queryResults = $this->request($url, $options);

        return $queryResults;
    }
287374
protected function sendRequest($url, $method = 'get', array $options = [])
    {
        return $this->send(
          new Request($method, $url),
          $this->client,
          $options
        );
    }
495039
protected function fetchFsock($url, $options = array())
    {
        $this->debug->groupCollapsed(__METHOD__);
        $return = false;
        $urlParts = Html::parseUrl($url);
        // $this->debug->log('urlParts', $urlParts);
        // $this->debug->log('options', $options);
        if (!empty($options['proxy']) && !\in_array($urlParts['host'], array('127.0.0.1','localhost'))) {
            $this->debug->log('proxy', $options['proxy']);
            $request = 'GET '.$url.' HTTP/1.0'."\r\n";
            $proxyParts = \parse_url($options['proxy']);
            $pointer = \fsockopen($proxyParts['host'], $proxyParts['port'], $errno, $errstr, $options['timeout']);
        } else {
            $uri = $urlParts['path'].( !empty($urlParts['query']) ? '?'.$urlParts['query'] : '' );
            $request = 'GET '.$uri.' HTTP/1.0'."\r\n";
            $pointer = \fsockopen($urlParts['host'], $urlParts['port'], $errno, $errstr, $options['timeout']);
        }
        if ($pointer) {
            $host = $urlParts['host'].( $urlParts['port'] != '80' ? ':'.$urlParts['port'] : '' );
            $return = '';
            $request .= ''
                .'Host: '.$host."\r\n"
                .'Referer: '.Html::getSelfUrl(array(), array('fullUrl'=>true,'chars'=>false))."\r\n"
                .( !empty($urlParts['user'])
                    ? 'Authorization: Basic '.\base64_encode($urlParts['user'].':'.$urlParts['pass'])."\r\n"
                    : ''
                )
                ."\r\n";
            $this->debug->log('request', $request);
            \fputs($pointer, $request);
            while (!\feof($pointer)) {
                $return .= \fread($pointer, 4096);
            }
            \fclose($pointer);
            $this->debug->log('return', $return);
            $header_start = 0;
            while (true) {
                $header_end     = \strpos($return, "\r\n\r\n", $header_start);
                $header_length  = $header_end-$header_start;
                $headers        = \substr($return, $header_start, $header_length);
                $header_start   = $header_end+4;
                if (!\preg_match('/^HTTP.+Continue/i', $headers)) {
                    break;
                }
            }
            $this->debug->log('headers', $headers);
            $parsedHeaders = Net::parseHeaders($headers);
            $return = array(
                'headers'   => $parsedHeaders,
                'body'      => \substr($return, $header_end+4),
                'cookies'   => $this->getCookies($parsedHeaders),
            );
            $this->fetchResponse = $return;
            if (isset($return['headers']['Location'])) {
                $this->debug->log('headers', $return['headers']);
                $location = Html::getAbsUrl($urlParts, $return['headers']['Location']);
                $return = $this->fetch($location, $options);
            } elseif ($return['headers']['Return-Code'] != '200') {
                $this->debug->log('return[headers]', $return['headers']);
                if (isset($return['headers']['Proxy-Authenticate'])
                    && ( $return['headers']['Proxy-Authenticate'] == 'NTLM' || \in_array('NTLM', $return['headers']['Proxy-Authenticate']))
                ) {
                    $return = $this->fetchCurl($url, $options);
                    $return['headers']['Current-Location'] = $url;
                } else {
                    $this->debug->log('return was', $return);
                    $return = false;
                }
            }
        } else {
            $this->debug->warn('Error ('.$errno.') : ', $errstr);
        }
        $this->debug->groupEnd();
        return $return;
    }
450305
public function get($url, $params = array(), $options = array()) {
        $options['CURLOPT_HTTPGET'] = 1;

        if (!empty($params)) {
            $url .= (stripos($url, '?') !== false) ? '&' : '?';
            $url .= http_build_query($params, '', '&');
        }
        return $this->request($url, $options);
    }
943257
public function build_url( $url, $options = array() ) {

		$url = (array) $url;

		$allow_port = (int) pods_v( static::$type . '_allow_port', $options, 0 );

		// If port is not allowed, always set to empty
		if ( 0 === $allow_port ) {
			$url['port'] = '';
		}

		if ( function_exists( 'http_build_url' ) ) {
			return http_build_url( $url );
		}

		$defaults = array(
			'scheme'   => 'http',
			'host'     => '',
			'port'     => '',
			'path'     => '/',
			'query'    => '',
			'fragment' => '',
		);

		$url = array_merge( $defaults, $url );

		$new_url = array();

		$new_url[] = trim( $url['scheme'] . '://', ':' );
		$new_url[] = $url['host'];

		if ( ! empty( $url['port'] ) ) {
			$new_url[] = ':' . $url['port'];
		}

		$new_url[] = '/' . ltrim( $url['path'], '/' );

		if ( ! empty( $url['query'] ) ) {
			$new_url[] = '?' . ltrim( $url['query'], '?' );
		}

		if ( ! empty( $url['fragment'] ) ) {
			$new_url[] = '#' . ltrim( $url['fragment'], '#' );
		}

		// Pull all of the parts back together
		$new_url = implode( '', $new_url );

		return $new_url;

	}