php class Parser protected res public function setText res this res re

 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
49
50
<?php
class Parser {
protected $res;
public function setText($res) {
$this -> res = $res;
return $this;
}
public function getRealURI() {
preg_match('/Object moved to <a href="(.*?)"/', $this -> res, $data);
return isset($data[1]) ? 'https://www.vfsvisaonline.com' . urldecode($data[1]) : false;
}
public function getValueById($id) {
preg_match('/id="'. $id .'" value="(.*?)"/i', $this -> res, $data);
return $data[1];
}
public function getFormAction() {
preg_match('/method="post" action="(.*?)"/i', $this -> res, $data);
return $data[1];
}
public function getRealPath($uri) {
return preg_replace('/[A-z0-9]+\.aspx.*?$/i', '', $uri);
}
public function getTarget($val) {
preg_match('/href=".*?\'(.*?)\'.*?">'. $val .'/i', $this -> res, $data);
return $data[1];
}
public function getArgument($val) {
preg_match('/href=".*?,\'(.*?)\'.*?">'. $val .'/i', $this -> res, $data);
return $data[1];
}
public function getName($end) {
preg_match('/name="(.*?)'. $end .'"/i', $this -> res, $data);
return $data[1] . $end;
}
public function getId($end) {
preg_match('/id="(.*?)'. $end .'"/i', $this -> res, $data);
return $data[1] . $end;
}
}