yii\httpclient\Request::getUrl PHP Method

getUrl() public method

Returns target URL.
public getUrl ( ) : string | array
return string | array target URL or URL parameters
    public function getUrl()
    {
        return $this->_url;
    }

Usage Example

 /**
  * @inheritdoc
  */
 public function format(Request $request)
 {
     $data = (array) $request->getData();
     $content = http_build_query($data, '', '&', $this->encodingType);
     if (strcasecmp('get', $request->getMethod()) === 0) {
         if (!empty($content)) {
             $url = $request->getUrl();
             $url .= strpos($url, '?') === false ? '?' : '&';
             $url .= $content;
             $request->setUrl($url);
         }
         return $request;
     }
     $request->getHeaders()->set('Content-Type', 'application/x-www-form-urlencoded');
     $request->setContent($content);
     return $request;
 }
All Usage Examples Of yii\httpclient\Request::getUrl