public $cfg;
protected $uploadsInfo = [];
+ protected $dedicatedBody = false;
public function __construct($host, $cfg)
{
public function send($body = null)
{
if ($body !== null) {
+ $this->dedicatedBody = true;
$this->req->setBody($body);
}
if ($this->cfg->debug) {
return $this->req->addUpload($fieldName, $filename);
}
+ /**
+ * Add one or multiple POST parameters.
+ * Automatically adds them as array or as string.
+ *
+ * @param string $key Parameter name
+ * @param string|array $values One or multiple values
+ */
+ public function addPostParameter($key, $values)
+ {
+ if (count($values) == 1) {
+ $values = reset($values);
+ }
+ $this->req->addPostParameter($key, $values);
+ }
+
protected function printCurl()
{
$command = 'curl';
}
}
+ if ($this->dedicatedBody) {
+ $command .= ' --data ' . escapeshellarg($this->req->getBody());
+ }
+
$command .= ' ' . escapeshellarg((string) $this->req->getUrl());
- echo $command . "\n";
+ Log::msg($command);
}
}
\ No newline at end of file