-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfundaRecentActive.php
89 lines (66 loc) · 1.88 KB
/
fundaRecentActive.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<?php
/**
* @file
*
* @brief Script for getting an json string with latest properties.
*
* @details
*
* @author Jordi van Nistelrooij @ Webs en Systems
* @email [email protected]
* @website https://websensystems.nl
* @version 1.0.0
* @date 2021-01-11
* @copyright Non of these scripts maybe copied or modified without permission of the authors
*
* @note
* @todo
* @bug
*/
if(isset($_REQUEST["FundaURL"])){
$siteName = $_REQUEST["FundaURL"];
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FORBID_REUSE, true);
curl_setopt($ch, CURLOPT_HEADER, false);
//curl_setopt($ch, CURLINFO_HEADER_OUT, true);
//curl_setopt($ch, CURLOPT_CERTINFO, true);
curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
//curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_URL, $siteName);
// Execute
$response = curl_exec($ch);
curl_close($ch);
$dom = new DOMDocument;
$dom->loadHTML($response);
/**
* ELEMENT SEARCH
$divs = $dom->getElementsByTagName("div");
for($i; $i < $divs->length; $i++){
if($divs->item($i)->getAttribute("class") == "object-description-body"){
echo $i . "<==========";
}
}
*
*
*/
$arrayLinks = $dom->getElementsByTagName("a");
for($i = 0; $i < $arrayLinks->length; $i++){
if($arrayLinks->item($i)->getAttribute("data-object-url-tracking") == "recenteactiviteit"){
$title = $arrayLinks->item($i)->getAttribute("title");
$addURL = "https://funda.nl" . $arrayLinks->item($i)->getAttribute("href");
$status = explode(" ",$arrayLinks->item($i)->childNodes->item(9)->childNodes->item(1)->nodeValue)[0];
$arrayFunda[] = array("Titel" => $title, "URL" => $addURL, "Status"=> $status);
}
}
echo json_encode($arrayFunda);
}else{
?>
<br/>
<form >
<input name=FundaURL placeholder=FundaURL>
<input type=submit>
</form>
<?PHP
}
?>