function post_job($job_request_filename, $job_data_filename) { $job_request = file_get_contents($job_request_filename); $job_data = null; if ($job_data_filename != null) { $fh = fopen($job_data_filename, "rb"); if ($fh) { $job_data = fread($fh, filesize($job_data_filename)); fclose($fh); } } $result = Resources::post_job($job_request, $job_data); if ($result['success'] == false) { show_message("Operation failed with status code " . $result['status-code']); return; } show_message("New job created: " . implode("\n", $result['data'])); }