Instaphp/Instagram/InstagramBase.php
protected function BuildUrl($path = null, $action = null)
    {
        $uri = $this->config['endpoint'] . '/' . $this->config['version'];


        if (!empty($path) && substr($path, 0, 1) !== '/')
            $path = '/' . $path;

        $path = $this->api_path . $path;

        $uri .= $path;

        if (null !== $action) {
            if (substr($action, 0, 1) !== '/')
                $action = '/' . $action;

            if (substr($action, strlen($action) - 1, 1) !== '/')
                $action .= '/';

            $uri .= $action;
        }

        return $uri;
    }
protected function BuildUrl($path = null, $action = null)
    {
        $uri = $this->config['endpoint'] . '/' . $this->config['version'];


        if (!empty($path) && substr($path, 0, 1) !== '/')
            $path = '/' . $path;

        $path = $this->api_path . $path;

        $uri .= $path;

        if (null !== $action) {
            if (substr($action, 0, 1) !== '/')
                $action = '/' . $action;

            if (substr($action, strlen($action) - 1, 1) !== '/')
                $action .= '/';

            $uri .= $action;
        }

        return $uri;
    }
A convenience method that builds a base URL to the Instagram API based on
values in the config.xml file and the $api_path property.
@access protected
@param string $path The path to append to the base URL to create the endpoint
@param string $action The 'action' to append to the endpoint (not always used, but available)
@return string The Instagram API endpoint