Example #1
0
 public function rewind()
 {
     if (!$this->file->isOpen()) {
         $this->file->openForRead();
     }
     $this->file->rewind();
     $this->count = 0;
     $this->next();
 }
Example #2
0
 /**
  * execute request and saves output into file
  *
  * @param string|null $file
  *
  * @return IFile
  * @throws ClientException
  */
 public function save($file = null)
 {
     $this->file = $file ? new File($file) : new TempFile();
     $this->file->openForWrite();
     curl_setopt_array($this->curl, [CURLOPT_RETURNTRANSFER => false, CURLOPT_FILE => $this->file->getHandle()]);
     $this->exec();
     $this->file->close();
     return $this->file;
 }