-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfetcher.php
More file actions
48 lines (26 loc) · 922 Bytes
/
fetcher.php
File metadata and controls
48 lines (26 loc) · 922 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
header ("Content-Type:text/html; charset=utf-8");
require_once 'HTTP/Request2.php'; // uses Pear
require_once 'globalVariables.php';
$request = new HTTP_Request2($locconnect.'fetch_job.php?com=WFR');
$request->setMethod(HTTP_Request2::METHOD_GET);
$jobs=$request->send()->getBody();
$filecontent = $locconnect."fetch_job.php?com=WFR";
$filestring = file_get_contents($filecontent);
if (strpos($filestring, "error") == true){
print "Waiting for a job...";}
else {
$xmlDoc = new DOMDocument();
$xmlDoc->load($filecontent);
$jobs = $xmlDoc->getElementsByTagName('job');
for ($i = 0; $i < $jobs->length; $i++) {
$arr[$i]= $jobs->item($i)->nodeValue;
}
$sarr = serialize($arr);
$request = new HTTP_Request2($this_url . '/fileGetterAndSaver.php');
$request->setMethod(HTTP_Request2::METHOD_POST)
->addPostParameter('jobs', $sarr);
$melons=$request->send()->getBody();
print $melons;
}
?>