Is the passed string a URL?

@param string $url  string/URL to test
@param array  $opts options

@return boolean
961710
public static function isUrl($url, $opts = array())
	{
		$opts = \array_merge(array(
			'requireSchema' => true,
		), $opts);
		$urlRegEx = '@^'
			.($opts['requireSchema']
				? 'https?://'
				: '(https?://)?'
				)
			.'[-\w\.]+'		// hostname
			.'(:\d+)?'		// port
			// .'(/([-\w/\.]*(\?\S+)?)?)?@';
			.'('
				.'/'
				.'('
					.'[-\w/\.,%:]*'	// path
					.'(\?\S+)?'		// query
					.'(#\S*)?'		// fragment/hash
				.')?'
			.')?'
			.'$@';
		return \preg_match($urlRegEx, $url) > 0;
	}
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);
    }
479633
public function read(array $opts) {
        return array_merge_recursive(parent::read($opts), [
            'verb' => [
                'id' => 'http://adlnet.gov/expapi/verbs/completed',
                'display' => $this->readVerbDisplay($opts),
            ],
            'object' => $this->readModule($opts),
            'context' => [
                'contextActivities' => [
                    'grouping' => [
                        $this->readCourse($opts),
                    ],
                ],
            ],
        ]);
    }
626080
public function get($url, $params = array(), $options = array())
    {
        return $this->request($url, self::GET, $params, $options);
    }
255736
public function equals($otherUrl, $opt = self::SCHEME | self::HOST | self::PORT | self::CREDENTIALS | self::PATH | self::QUERY | self::FRAGMENT)
	{
		if ($otherUrl instanceof Url) {
			$url = $otherUrl;
		} else if (is_string($otherUrl)) {
			$url = new Url($otherUrl);
		} else {
			throw new InvalidUrlException();
		}
		$scheme = ($opt & self::SCHEME) === self::SCHEME;
		$host = ($opt & self::HOST) === self::HOST;
		$port = ($opt & self::PORT) === self::PORT;
		$creds = ($opt & self::CREDENTIALS) === self::CREDENTIALS;
		$path = ($opt & self::PATH) === self::PATH;
		$query = ($opt & self::QUERY) === self::QUERY;
		$fragment = ($opt & self::FRAGMENT) === self::FRAGMENT;
		if ($scheme && ! $this->scheme->equals($url->scheme)) {
			return false;
		}
		if ($host && ! $this->host->equals($url->host)) {
			return false;
		}
		if ($port && ! $this->port->equals($url->port)) {
			return false;
		}
		if ($creds && ! $this->credentials->equals($url->credentials)) {
			return false;
		}
		if ($path && ! $this->path->equals($url->path)) {
			return false;
		}
		if ($query && ! $this->query->equals($url->query)) {
			return false;
		}
		if ($fragment && ! $this->fragment->equals($url->fragment)) {
			return false;
		}
		return true;
	}
976255
protected function executeWebhook(array $opts, array $files) {
        return $this->client->apimanager()->endpoints->webhook->executeWebhook($this->id, $this->token, $opts, $files, array('wait' => true))->then(function ($data) {
            $channel = $this->client->channels->get($this->channelID);
            if($channel instanceof \CharlotteDunois\Yasmin\Interfaces\TextChannelInterface) {
                return $channel->_createMessage($data);
            }
            
            return $data;
        });
    }
308282
protected function createClient(array $opts=[])
  {
    if ( !$this->guzzleClient ) {
      $this->guzzleClient = new \GuzzleHttp\Client();
      $this->cookieJar = new \GuzzleHttp\Cookie\CookieJar();
    }

    return $this->guzzleClient;
  }
29343
final protected function curlFilterOpts(array &$opts = array())
	{
		$keys = array_keys($opts);
		$values = array_values($opts);
		array_filter($keys, [$this, 'curlFilterOpt']);
		foreach (array_diff(array_keys($opts), $keys) as $key) {
			unset($values[array_search($key, array_keys($opts))]);
		}
		$opts = array_combine($keys, $values);
	}
815141
protected function _socket($url,$options) {
		$eol="\r\n";
		$headers=array();
		$body='';
		$parts=parse_url($url);
		$empty=empty($parts['port']);
		if ($parts['scheme']=='https') {
			$parts['host']='ssl://'.$parts['host'];
			if ($empty)
				$parts['port']=443;
		}
		elseif ($empty)
			$parts['port']=80;
		if (empty($parts['path']))
			$parts['path']='/';
		if (empty($parts['query']))
			$parts['query']='';
		$socket=@fsockopen($parts['host'],$parts['port']);
		if (!$socket)
			return FALSE;
		stream_set_blocking($socket,TRUE);
		stream_set_timeout($socket,$options['timeout']);
		fputs($socket,$options['method'].' '.$parts['path'].
			($parts['query']?('?'.$parts['query']):'').' HTTP/1.0'.$eol
		);
		fputs($socket,implode($eol,$options['header']).$eol.$eol);
		if (isset($options['content']))
			fputs($socket,$options['content'].$eol);
		// Get response
		$content='';
		while (!feof($socket) &&
			($info=stream_get_meta_data($socket)) &&
			!$info['timed_out'] && !connection_aborted() &&
			$str=fgets($socket,4096))
			$content.=$str;
		fclose($socket);
		$html=explode($eol.$eol,$content,2);
		$body=isset($html[1])?$html[1]:'';
		$headers=array_merge($headers,$current=explode($eol,$html[0]));
		$match=NULL;
		foreach ($current as $header)
			if (preg_match('/Content-Encoding: (.+)/',$header,$match))
				break;
		if ($match)
			switch ($match[1]) {
				case 'gzip':
					$body=gzdecode($body);
					break;
				case 'deflate':
					$body=gzuncompress($body);
					break;
			}
		if ($options['follow_location'] &&
			preg_match('/Location: (.+?)'.preg_quote($eol).'/',
			$html[0],$loc)) {
			$options['max_redirects']--;
			return $this->request($loc[1],$options);
		}
		return array(
			'body'=>$body,
			'headers'=>$headers,
			'engine'=>'socket',
			'cached'=>FALSE
		);
	}
1322240
public static function parse($opts)
    {
        if ($opts instanceof self) {
            return $opts;
        }
        if (is_null($opts)) {
            return new Options(null, array());
        }
        if (is_array($opts)) {
            $key = null;
            if (array_key_exists('api_key', $opts)) {
                $key = $opts['api_key'];
                unset($opts['api_key']);
            }
            return new Options($key, $opts);
        } else {
            throw new Error\InvalidOption('Options have to be array.');
        }
    }
177178
public static function post(string $url, array $options = []) : array {
		$result = [
			'success' => false,
			'error' => [],
			'data' => null
		];
		$ch = curl_init();
		curl_setopt($ch, CURLOPT_URL, $url);
		curl_setopt($ch, CURLOPT_POST, 1);
		curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query2($options['params']));
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
		$result['data'] = curl_exec($ch);
		if (!empty($options['json'])) {
			$result['data'] = json_decode($result['data'], true);
		}
		curl_close($ch);
		$result['success'] = true;
		return $result;
	}
451725
public function read(array $opts) {

        $scoreRaw = (float) ($opts['grade']->grade ?: 0);
        $scoreMin = (float) ($opts['grade_items']->grademin ?: 0);
        $scoreMax = (float) ($opts['grade_items']->grademax ?: 0);
        $scorePass = (float) ($opts['grade_items']->gradepass ?: null);
        $success = false;
        //if there is no passing score then success is unknown.
        if ($scorePass == null) {
            $success = null;
        }
        elseif ($scoreRaw >= $scorePass) {
            $success = true;
        }
        //Calculate scaled score as the distance from zero towards the max (or min for negative scores).
        $scoreScaled;
        if ($scoreRaw >= 0) {
            $scoreScaled = $scoreRaw / $scoreMax;
        }
        else
        {
            $scoreScaled = $scoreRaw / $scoreMin;
        }

        return [array_merge(parent::read($opts)[0], [
            'recipe' => 'assignment_graded',
            'graded_user_id' => $opts['graded_user']->id,
            'graded_user_url' => $opts['graded_user']->url,
            'graded_user_name' => $opts['graded_user']->fullname,
            'grade_score_raw' => $scoreRaw,
            'grade_score_min' => $scoreMin,
            'grade_score_max' => $scoreMax,
            'grade_score_scaled' => $scoreScaled,
            'grade_success' => $success,
            'grade_completed' => true,
            'grade_comment' => strip_tags($opts['grade_comment']),
        ])];
    }
851045
function get(url, opts){
	opts = opts || {};

	return requestp(_.extend(defaults, opts, {
		url: url
	}));
}
1211095
public static function isUrl(string $url, bool $requiredScheme = false): bool
    {
        $pattern = '#^'.($requiredScheme ? 'https?://' : '((https?:)?//)?').'[a-z0-9]([-a-z0-9\.]*[a-z0-9])?\.[a-z]{2,10}(:\d{1,5})?(/.*)?$#i';

        return preg_match($pattern, $url);
    }
205626
public function post($url, array $options = [])
    {
        return $this->responseBuilder->build($this->send(new Request('POST', $url), $options));
    }
1273954
public function view($params, $optParams = [])
    {
        if ($params instanceof Firewall) {
            $params = $params->id;
        }

        return $this->sendRequest([], [
            'restAction' => 'view',
            'restId' => $params,
            'getParams' => $optParams,
        ], function ($response) {
            return isset($response->data) ? new Firewall($response->data) : $response;
        });
    }
905129
public static function get(string $url, array $options = []) : array {
		$result = [
			'success' => false,
			'error' => [],
			'data' => null
		];
		if (strpos($url, '?') !== false) {
			$url.= '&';
		} else {
			$url.= '?';
		}
		$url.= http_build_query2($options['params']);
		$ch = curl_init();
		curl_setopt($ch, CURLOPT_URL, $url);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
		$result['data'] = curl_exec($ch);
		if (!empty($options['json'])) {
			$result['data'] = json_decode($result['data'], true);
		}
		curl_close($ch);
		$result['success'] = true;
		return $result;
	}