Skip to content

About AbstractModel

georgesvash edited this page Nov 7, 2018 · 2 revisions

Methods available for use with the configuration of the Builder.

  • ->setOpt('field', 'value') - this method is the abridge of setOption, where the first argument is a field used by DataForSEO, the second is its value.

  • setExtraToRequestUrl($param) - this method adds a particular value to the request's URL. For example, before executing this method, the url was: dataforseo.com/kwrd_sv_batch_tasks_get, after executing the method becomes: dataforseo.com/kwrd_sv_batch_tasks_get/$yourparam.

    public function setExtraToRequestUrl($extra)
    {
        $this->requestToFunction = $this->requestToFunction.'/'.$extra;

        return $this;
    }
  • setTimeOut($newTimeout) - Sets a new timeout for each request.
   public function setTimeOut($newTimeout)
   {
       $this->timeOut = $newTimeout;

       return $this;
   }
  • setMethod($newMethod) - Sets the method of an http request: GET,POST, DELETE, etc.
   public function setMethod($newMethod)
   {
       $this->method = $newMethod;

       return $this;
   }
  • setUrl($newUrl) - Sets a completely new URL.
   public function setUrl($newUrl)
   {
       $this->url = $newUrl;

       return $this;
   }
  • setApiVersion($newVersion) - Set a particular version of the API that will be used in the request.
   public function setApiVersion($newVersion)
   {
       $this->apiVersion = $newVersion;

       return $this;
   }
  • setPostId($id) - Set a key for an array in the payload, where a key will be equal to the $id.
   public function setPostId($id)
   {
       $this->postId = $id;

       return $this;
   }
  • setPathToMainData($newPath) - Since you receive all the main data for the request at the point of iteration, you can set a route to this data yourself. This way, you can access the data that you specified in the $newPath at the point of iteration by the foreach cycle.
   public function setPathToMainData($newPath)
   {
       $this->pathToMainData = $newPath;

       return $this;
   }
   public function setRequestToFunction($newRequestToFunction)
   {
       $this->requestToFunction = $newRequestToFunction;

       return $this;
   }

Getting Started

  1. Home
  2. Installation
  3. Configuration
  4. Base Usage
  5. Response Collection
  6. Abstract Model

DataForSEO APIs

Clone this wiki locally