-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.php
49 lines (39 loc) · 919 Bytes
/
app.php
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
<?php
error_reporting(0);
const VERSION = "1.9.7"
/*
// Create a stream
$opts = array(
'http'=>array(
'method'=>"GET",
'header'=>"Accept-language: en\r\n" .
"Cookie: foo=bar\r\n"
)
);
//reuired because site using cookies
$context = stream_context_create($opts);
// Open the file using the HTTP headers set above
$html = file_get_contents('https://journals.sagepub.com/home/VRT', false, $context);
$dom = new domDocument;
// load the html into the object
$dom->loadHTML($html);
// discard white space
$dom->preserveWhiteSpace = false;
//*** the table by its tag name ***
$aElements = $dom->getElementsByTagName('a');
//echo "<pre>";
foreach($aElements as $t){
if($t->textContent == "Submit Paper"){
//print_r($t);
//fetch the URL of "href" attribute
foreach($t->attributes as $a){
if($a->name ==="href"){
echo $a->value;
break;
}
}
break;
}
}
*/
?>