~ubuntu-branches/debian/sid/boinc/sid

« back to all changes in this revision

Viewing changes to html/ops/submit_example.php

  • Committer: Package Import Robot
  • Author(s): Steffen Moeller
  • Date: 2011-08-08 01:36:51 UTC
  • mfrom: (6.1.11 experimental)
  • Revision ID: package-import@ubuntu.com-20110808013651-m1hs3cltiveuteyn
Tags: 6.13.1+dfsg-2
* Bringing notify patch to unstable.
* Adjusted build dependency to libjpeg-dev (Closes: #641093)
* Further improvements on stripchart.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
// This file is part of BOINC.
 
3
// http://boinc.berkeley.edu
 
4
// Copyright (C) 2011 University of California
 
5
//
 
6
// BOINC is free software; you can redistribute it and/or modify it
 
7
// under the terms of the GNU Lesser General Public License
 
8
// as published by the Free Software Foundation,
 
9
// either version 3 of the License, or (at your option) any later version.
 
10
//
 
11
// BOINC is distributed in the hope that it will be useful,
 
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
14
// See the GNU Lesser General Public License for more details.
 
15
//
 
16
// You should have received a copy of the GNU Lesser General Public License
 
17
// along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
 
18
 
 
19
// example code for making a remote job submission
 
20
 
 
21
$ch = curl_init("http://foo.edu/test/submit.php");
 
22
curl_setopt($ch, CURLOPT_POST, 1);
 
23
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 
24
curl_setopt($ch, CURLOPT_POSTFIELDS, "request=
 
25
    <batch_submit>
 
26
        <authenticator>xxx</authenticator>
 
27
        <batch>
 
28
        <app_name>uppercase</app_name>
 
29
        <job>
 
30
            <rsc_fpops_est>100e9</rsc_fpops_est>
 
31
            <command_line>--t ALPHA</command_line>
 
32
            <input_file>
 
33
                <source>http://foo.edu/index.php</source>
 
34
                <physical_name>name</physical_name>
 
35
            </input_file>
 
36
        </job>
 
37
        </batch>
 
38
    </batch_submit>
 
39
");
 
40
$reply = curl_exec($ch);
 
41
if (!$reply) die("HTTP op failed\n");
 
42
echo "reply: $reply\n"; exit;
 
43
 
 
44
$r = simplexml_load_string($reply);
 
45
if (!$r) die("bad reply: $reply\n");
 
46
$name = $r->getName();
 
47
if ($name == 'estimate') {
 
48
    echo "estimate: ".(string)$r->seconds."\n";
 
49
} else if ($name == 'error') {
 
50
    foreach ($r->message as $msg) {
 
51
        echo "$msg\n";
 
52
    }
 
53
} else {
 
54
    die("bad reply\n");
 
55
}
 
56
 
 
57
?>