Changes between Version 5 and Version 6 of RemoteJobs
- Timestamp:
- Jun 18, 2011, 8:42:38 AM (13 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
RemoteJobs
v5 v6 152 152 153 153 {{{ 154 $ch = curl_init("http ://project.edu/job_control.php");154 $ch = curl_init("https://project.edu/job_control.php"); 155 155 curl_setopt($ch, CURLOPT_POST, 1); 156 curl_setopt($ch, CURL_POSTFIELDS, " 156 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 157 curl_setopt($ch, CURLOPT_POSTFIELDS, "request= 157 158 <batch_estimate> 158 159 <batch> … … 165 166 "); 166 167 $reply = curl_exec($ch); 167 $r = new SimpleXMLElement($reply); 168 curl_close($ch); 169 170 if ($r->estimate) { 171 echo "Estimate: $r->estimate->seconds seconds\n"; 168 if (!$reply) die("HTTP op failed\n"); 169 $r = simplexml_load_string($reply); 170 if (!$r) die("bad reply: $reply\n"); 171 $name = $r->getName(); 172 if ($name == 'estimate') { 173 echo "estimate: ".(string)$r->seconds."\n"; 174 } else if ($name == 'error') { 175 foreach ($r->message as $msg) { 176 echo "$msg\n"; 177 } 172 178 } else { 173 echo "Error: $r->error->message\n";179 die("bad reply\n"); 174 180 } 175 181 }}}