Accepts either a single url or an array of urls.

@param string|array $topic_urls
@param callable     $http_function

@return mixed
968135
public function publish_update($topic_urls, $http_function = false)
    {
        if (! isset($topic_urls)) {
            throw new InvalidArgumentException('Please specify a topic url');
        }

        // check that we're working with an array
        if (! is_array($topic_urls)) {
            $topic_urls = [$topic_urls];
        }

        // set the mode to publish
        $post_string = 'hub.mode=publish';
        // loop through each topic url
        foreach ($topic_urls as $topic_url) {

            // lightweight check that we're actually working w/ a valid url
            if (! preg_match('|^https?://|i', $topic_url)) {
                throw new InvalidArgumentException('The specified topic url does not appear to be valid: ' . $topic_url);
            }

            // append the topic url parameters
            $post_string .= '&hub.url=' . urlencode($topic_url);
        }

        // make the http post request and return true/false
        // easy to over-write to use your own http function
        if ($http_function) {
            return $http_function($this->hub_url, $post_string);
        }

        return $this->http_post($this->hub_url, $post_string);
    }
1274242
def get_urlpatterns(self):
        
        urlpatterns = super().get_urlpatterns()

        conversation_urlpatterns = [
            path(
                _('topic/<str:slug>-<int:pk>/'),
                self.topic_view.as_view(),
                name='topic',
            ),
            path(_('topic/create/'), self.topic_create_view.as_view(), name='topic_create'),
            path(
                _('topic/<str:slug>-<int:pk>/update/'),
                self.topic_update_view.as_view(),
                name='topic_update',
            ),
            path(
                _('topic/<str:topic_slug>-<int:topic_pk>/post/create/'),
                self.post_create_view.as_view(),
                name='post_create',
            ),
            path(
                _('topic/<str:topic_slug>-<int:topic_pk>/<int:pk>/post/update/'),
                self.post_update_view.as_view(),
                name='post_update',
            ),
            path(
                _('topic/<str:topic_slug>-<int:topic_pk>/<int:pk>/post/delete/'),
                self.post_delete_view.as_view(),
                name='post_delete',
            ),
        ]

        urlpatterns += [
            path(
                _('forum/<str:forum_slug>-<int:forum_pk>/'),
                include(conversation_urlpatterns),
            ),
        ]

        return urlpatterns
904335
function(topicArray) {
    var regexArray = [];
    topicArray.forEach(function(filterString) {
      var regex = filterString.replace(/\/\+/g,'\\/.+').replace(/\/#$/g,'');
      regexArray.push(new RegExp(regex));
    });
    return regexArray;
  }
1353924
public static function http_post($url, $param, $timeOut = 5, $connectTimeOut = 5) {
		$oCurl = curl_init ();
		if (stripos ( $url, "http://" ) !== FALSE || stripos ( $url, "https://" ) !== FALSE) {
			curl_setopt ( $oCurl, CURLOPT_SSL_VERIFYPEER, FALSE );
			curl_setopt ( $oCurl, CURLOPT_SSL_VERIFYHOST, false );
		}
		if (is_string ( $param )) {
			$strPOST = $param;
		} else {
			$aPOST = array ();
			foreach ( $param as $key => $val ) {
				$aPOST [] = $key . "=" . urlencode ( $val );
			}
			$strPOST = join ( "&", $aPOST );
		}
		curl_setopt($oCurl, CURLOPT_URL, $url );
		curl_setopt($oCurl, CURLOPT_RETURNTRANSFER, 1 );
		curl_setopt($oCurl, CURLOPT_POST, true );
		curl_setopt($oCurl, CURLOPT_FOLLOWLOCATION, true);
		curl_setopt($oCurl, CURLOPT_POSTFIELDS, $strPOST );
		curl_setopt($oCurl, CURLOPT_TIMEOUT, $timeOut);
        curl_setopt($oCurl, CURLOPT_CONNECTTIMEOUT, $connectTimeOut);
		$sContent = curl_exec ($oCurl );
		$aStatus = curl_getinfo ($oCurl );
        $error = curl_error($oCurl );
		curl_close ($oCurl );
		if (intval ($aStatus ["http_code"] ) == 200) {
			return array(
					'status' => true,
					'content' => $sContent,
					'code' => $aStatus ["http_code"],
			);
		} else {
			return array(
					'status' => false,
					'content' => json_encode(array("error" => $error, "url" => $url)),
					'code' => $aStatus ["http_code"],
			);
		}
	}
337527
protected function request($url, $parameters = array(), $request = false)
        {
            $this->lastRequest = $url;
            $this->lastRequestData = $parameters;
            $this->responseHeaders = array();

            $curl = curl_init($url);

            $curlOptions = array(
                CURLOPT_SSL_VERIFYPEER => false,
                CURLOPT_REFERER        => $url,
                CURLOPT_RETURNTRANSFER => true,
                CURLOPT_HEADERFUNCTION => array($this, 'parseHeader'),
            );

            if (! empty($parameters) || ! empty($request)) {
                if (! empty($request)) {
                    $curlOptions[ CURLOPT_CUSTOMREQUEST ] = $request;
                    $parameters = http_build_query($parameters);
                } else {
                    $curlOptions[ CURLOPT_POST ] = true;
                }

                $curlOptions[ CURLOPT_POSTFIELDS ] = $parameters;
            }

            curl_setopt_array($curl, $curlOptions);

            $response = curl_exec($curl);
            $error    = curl_error($curl);

            $this->lastRequestInfo = curl_getinfo($curl);

            curl_close($curl);

            if (! empty($error)) {
                throw new \Exception($error);
            }

            return $this->parseResponse($response);
        }
845355
public function make_request($api_method, $args = array(),
                               $http_method = 'GET') {
    $args['format'] = 'json';
    $args['auth_token'] = $this->auth_token;
    $url = "$this->api_target/$this->api_version/$api_method";
    $post_data = null;

    // add args to url for GET
    if ($http_method == 'GET') {
      $url .= '?' . http_build_query($args);
    } else {
      $post_data = $args;
    }

    $response = $this->curl_request($url, $post_data);

    // make sure response is valid json
    $response = json_decode($response);
    if (!$response) {
      throw new HipChat_Exception(self::STATUS_BAD_RESPONSE,
        "Invalid JSON received: $response", $url);
    }

    return $response;
  }
1077320
private function httpGet($url, $query_arguments = [])
    {
        if (!empty($query_arguments)) {
            $url .= '?' . http_build_query($query_arguments);
        }

        return $this->executeCurlRequest($this->getCurlHandle($url), $url);
    }
1325968
function get_topic($all_posts = false)
	{
		if(!$this->_topic)
		{
			if($this->post_id)
			{
				//existing post, load existing topic
				$this->_topic = topic::get($this->topic_id, $all_posts);

				//insert $this into topic->posts array
				if($all_posts)
				{
					//this post was also loaded from database, replace it with $this
					for($i=0; $i<sizeof($this->_topic->posts); $i++)
					{
						if($this->_topic->posts[$i]->post_id == $this->post_id)
						{
							//found it
							$this->_topic->posts[$i] = &$this;
							break;
						}
					}
				}
				else
				{
					//no posts were loaded in topic::get(), add our post to topic->posts
					$this->_topic->posts[] = &$this;
				}
			}
			else
			{
				//new post, generate topic
				$this->_topic = topic::from_post($this);
			}
		}
		return $this->_topic;
	}
1140700
def topic
      if @topic
        @topic
      else
        connected do
          fiber = Fiber.current
          callbacks = {}
          [331, 332, 403, 442].each do |numeric|
            callbacks[numeric] = @thaum.on(numeric) do |event_data|
              topic = event_data[:params].match(':(.*)').captures.first
              fiber.resume topic
            end
          end

          raw "TOPIC #{@name}"
          @topic = Fiber.yield
          callbacks.each do |type, callback|
            @thaum.callbacks[type].delete(callback)
          end

          @topic
        end
      end
    end
559335
private function httpRequest(
        $url,
        $request,
        $data = array(),
        $sendHeaders = array(),
        $timeout = 10
    ) {
        $streamParams = array(
            'http' => array(
                'method' => $request,
                'ignore_errors' => true,
                'timeout' => $timeout,
                'header' => "User-Agent: " . $this->userAgent . "\r\n"
            )
        );
        foreach ($sendHeaders as $header => $value) {
            $streamParams['http']['header'] .= $header . ': ' . $value . "\r\n";
        }
        foreach ($this->extraHeaders as $header => $value) {
            $streamParams['http']['header'] .= $header . ': ' . $value . "\r\n";
        }

        if (is_array($data)) {
            if (in_array($request, array('POST', 'PUT')))
                $streamParams['http']['content'] = http_build_query($data);
            elseif ($data && count($data))
                $url .= '?' . http_build_query($data);
        } elseif ($data !== null) {
            if (in_array($request, array('POST', 'PUT')))
                $streamParams['http']['content'] = $data;
        }

        $streamParams['cURL'] = $streamParams['http'];

        $context = stream_context_create($streamParams);
        $fp = @fopen($url, 'rb', false, $context);
        if (!$fp)
            $content = false;
        else
            $content = stream_get_contents($fp);

        $status = null;
        $statusCode = null;
        $headers = array();

        if ($content !== false) {
            $metadata = stream_get_meta_data($fp);
            if (isset($metadata['wrapper_data']['headers']))
                $headerMetadata = $metadata['wrapper_data']['headers'];
            else
                $headerMetadata = $metadata['wrapper_data'];
            foreach ($headerMetadata as $row) {
                if (preg_match('/^HTTP\/1\.[01] (\d{3})\s*(.*)/', $row, $m)) {
                    $statusCode = $m[1];
                    $status = $m[2];
                } elseif (preg_match('/^([^:]+):\s*(.*)$/', $row, $m)) {
                    $headers[mb_strtolower($m[1])] = $m[2];
                }
            }
        }

        return (object) array(
            'ok' => $statusCode == 200,
            'statusCode' => $statusCode,
            'status' => $status,
            'content' => $content,
            'headers' => $headers
        );
    }
719283
static function url_merge($key, $value, $ignore = null, $urls = null)
    {
        $url = array();
        if ($urls === null) $urls = $_GET;

        $urls = array_merge($urls, array_combine(explode(',', $key), explode(',', $value)));
        if ($ignore !== null)
        {
            $ignores = explode(',', $ignore);
            foreach ($ignores as $ig)
            {
                unset($urls[$ig]);
            }
        }
        if (self::$url_prefix == '')
        {
            $qm = strpos($_SERVER['REQUEST_URI'], '?');
            if ($qm !== false)
            {
                $prefix = substr($_SERVER['REQUEST_URI'], 0, $qm + 1);
            }
            else
            {
                $prefix = $_SERVER['REQUEST_URI'] . '?';
            }
        }
        else
        {
            $prefix = self::$url_prefix;
        }
        return $prefix . http_build_query($urls) . self::$url_add_end;
    }
58650
protected function _getUrl(Subject $subject, array $url)
    {
        foreach ($url as $key => $value) {
            if (!is_array($value)) {
                continue;
            }

            if ($key === '?') {
                $url[$key] = $this->_getUrl($subject, $value);
                continue;
            }

            $url[$key] = $this->_getKey($subject, $value[0], $value[1]);
        }

        return $url;
    }
14013
function serializeTopics(topics) {
    return topics.map(function (topic) {
        if (typeof (topic) === 'string') {
            return topic;
        }
        else if (Array.isArray(topic)) {
            topic.forEach(function (topic) {
                if (topic !== null && bytes_1.hexDataLength(topic) !== 32) {
                    errors.throwError('invalid topic', errors.INVALID_ARGUMENT, { argument: 'topic', value: topic });
                }
            });
            return topic.join(',');
        }
        else if (topic === null) {
            return '';
        }
        return errors.throwError('invalid topic value', errors.INVALID_ARGUMENT, { argument: 'topic', value: topic });
    }).join('&');
}
1107606
public function subscribersByTopic(string $topic)
    {
        $key = self::TOPIC_KEY.".{$topic}";

        if (! $this->cache->has($key)) {
            return new Collection;
        }

        $channels = json_decode($this->cache->get($key), true);

        return (new Collection($channels))
            ->map(function (string $channel): ?Subscriber {
                return $this->subscriberByChannel($channel);
            })
            ->filter()
            ->values();
    }
923800
public Object[] getResults(String topic)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "getResults", topic);

    if (cachedResults != null)
    {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getResults", cachedResults);
      return cachedResults;
    }
    postProcess(topic);

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "getResults", "finalResults: " + Arrays.toString(finalResults));
    return finalResults;
  }
1091383
public function dispatch($http_method, $url)
    {
        if ($this->dispatcher === null) {
            throw new \RuntimeException('Route dispatcher is not initialized');
        }

        $this->dispatched_http_method = $http_method;
        $this->dispatched_url = $url;
        $this->route_info = $this->dispatcher->dispatch($http_method, $url);

        return $this->route_info;
    }
518041
public function pushShared($apiKey, array $topics, Pin $pin)
    {
        $url     = self::API_SHARED_URL.$pin->getId();
        $payload = $pin->generate();
        $headers = [
            self::API_SHARED_KEY    => $apiKey,
            self::API_SHARED_TOPICS => implode(',', $topics),
        ];

        $this->log("Pusher::pushShared => {$url}", ['payload' => $payload, 'headers' => $headers]);

        $this->push($url, $payload, $headers);
    }