seregazhuk\PinterestBot\Api\Request::exec PHP Method

exec() public method

Executes request to Pinterest API.
public exec ( string $resourceUrl, string $postString = '' ) : string
$resourceUrl string
$postString string
return string
    public function exec($resourceUrl, $postString = '')
    {
        $url = UrlBuilder::buildApiUrl($resourceUrl);
        $headers = $this->getHttpHeaders();
        $postString = $this->filePathToUpload ? $this->postFileData : $postString;
        $result = $this->httpClient->execute($url, $postString, $headers);
        $this->filePathToUpload = null;
        return $result;
    }

Usage Example

示例#1
0
 /**
  * @param $url
  * @param string $postString
  * @return $this
  */
 protected function execute($url, $postString = "")
 {
     $result = $this->request->exec($url, $postString);
     $this->processResult($result);
     return $this;
 }