src/IronWorker.php
public function postCode($filename, $zipFilename, $name, $options = array())
    {
        // Add IronWorker functions to the uploaded worker
        $this->addRunnerToArchive($zipFilename, $filename, $options);

        $this->setPostHeaders();
        $ts = time();
        $runtime_type = $this->runtimeFileType($filename);
        $sendingData = array(
            "code_name"  => $name,
            "name"       => $name,
            "standalone" => true,
            "runtime"    => $runtime_type,
            "file_name"  => "runner.php",
            "version"    => $this->version,
            "timestamp"  => $ts,
            "oauth"      => $this->token,
            "class_name" => $name,
            "options"    => array(),
            "access_key" => $name,
        );
        $sendingData = array_merge($sendingData, $options);
        $url = "projects/{$this->project_id}/codes";
        $post = array(
            "data" => json_encode($sendingData),
        );
        if ($this->curlEnabled() && version_compare(PHP_VERSION, '5.5.0', '>=')) {
            $post['file'] = new \CURLFile($zipFilename);
        } else {
            $post['file'] = '@' . $zipFilename;
        }
        $response = $this->apiCall(self::POST, $url, array(), $post);
        return self::json_decode($response);
    }
public function postCode($filename, $zipFilename, $name, $options = array())
    {
        // Add IronWorker functions to the uploaded worker
        $this->addRunnerToArchive($zipFilename, $filename, $options);

        $this->setPostHeaders();
        $ts = time();
        $runtime_type = $this->runtimeFileType($filename);
        $sendingData = array(
            "code_name"  => $name,
            "name"       => $name,
            "standalone" => true,
            "runtime"    => $runtime_type,
            "file_name"  => "runner.php",
            "version"    => $this->version,
            "timestamp"  => $ts,
            "oauth"      => $this->token,
            "class_name" => $name,
            "options"    => array(),
            "access_key" => $name,
        );
        $sendingData = array_merge($sendingData, $options);
        $url = "projects/{$this->project_id}/codes";
        $post = array(
            "data" => json_encode($sendingData),
        );
        if ($this->curlEnabled() && version_compare(PHP_VERSION, '5.5.0', '>=')) {
            $post['file'] = new \CURLFile($zipFilename);
        } else {
            $post['file'] = '@' . $zipFilename;
        }
        $response = $this->apiCall(self::POST, $url, array(), $post);
        return self::json_decode($response);
    }
public function postCode ( $ filename , $ zipFilename , $ name , $ options = array ( ) ) { // Add IronWorker functions to the uploaded worker $ this -> addRunnerToArchive ( $ zipFilename , $ filename , $ options ) ; $ this -> setPostHeaders ( ) ; $ ts = time ( ) ; $ runtime_type = $ this -> runtimeFileType ( $ filename ) ; $ sendingData = array ( "code_name" => $ name , "name" => $ name , "standalone" => true , "runtime" => $ runtime_type , "file_name" => "runner.php" , "version" => $ this -> version , "timestamp" => $ ts , "oauth" => $ this -> token , "class_name" => $ name , "options" => array ( ) , "access_key" => $ name , ) ; $ sendingData = array_merge ( $ sendingData , $ options ) ; $ url = "projects/{$this->project_id}/codes" ; $ post = array ( "data" => json_encode ( $ sendingData ) , ) ; if ( $ this -> curlEnabled ( ) && version_compare ( PHP_VERSION , '5.5.0' , '>=' ) ) { $ post [ 'file' ] = new \ CURLFile ( $ zipFilename ) ; } else { $ post [ 'file' ] = '@' . $ zipFilename ; } $ response = $ this -> apiCall ( self :: POST , $ url , array ( ) , $ post ) ; return self :: json_decode ( $ response ) ; }
Uploads your code package

@param string $filename This file will be launched as worker
@param string $zipFilename zip file containing code to execute
@param string $name referenceable (unique) name for your worker
@param array $options Optional parameters:
- "max_concurrency" The maximum number of tasks that should be run in parallel.
- "retries" The number of auto-retries of failed task.
- "retries_delay" Delay in seconds between retries.
- "config" : An arbitrary string (usually YAML or JSON) that, if provided,
will be available in a file that your worker can access.
File location will be passed in via the -config argument.
The config cannot be larger than 64KB in size.
@return mixed
Uploads your code package