summaryrefslogtreecommitdiffstats
path: root/main.php
diff options
context:
space:
mode:
authorAnton Luka Šijanec <sijanecantonluka@gmail.com>2020-01-13 21:27:50 +0100
committerAnton Luka Šijanec <sijanecantonluka@gmail.com>2020-01-13 21:27:50 +0100
commitaf34801906f6ea8e7e2991423accac8bb9b4f21d (patch)
tree1c1265078b061e1bf0794168923ca0485a48629b /main.php
parentlegal (diff)
downloaditisclient-af34801906f6ea8e7e2991423accac8bb9b4f21d.tar
itisclient-af34801906f6ea8e7e2991423accac8bb9b4f21d.tar.gz
itisclient-af34801906f6ea8e7e2991423accac8bb9b4f21d.tar.bz2
itisclient-af34801906f6ea8e7e2991423accac8bb9b4f21d.tar.lz
itisclient-af34801906f6ea8e7e2991423accac8bb9b4f21d.tar.xz
itisclient-af34801906f6ea8e7e2991423accac8bb9b4f21d.tar.zst
itisclient-af34801906f6ea8e7e2991423accac8bb9b4f21d.zip
Diffstat (limited to 'main.php')
-rw-r--r--main.php61
1 files changed, 50 insertions, 11 deletions
diff --git a/main.php b/main.php
index 06f9d34..33cad43 100644
--- a/main.php
+++ b/main.php
@@ -25,13 +25,16 @@ function is_domDocument($object)
}
}
function DOMinnerHTML($element) {
- if(!is_domDocument($element)) return -6;
- $innerHTML = "";
- $children = $element->childNodes;
- foreach ($children as $child) {
- $innerHTML .= $element->ownerDocument->saveHTML($child);
- }
- return $innerHTML;
+ try {
+ $innerHTML = "";
+ $children = $element->childNodes;
+ foreach ($children as $child) {
+ $innerHTML .= $element->ownerDocument->saveHTML($child);
+ }
+ return $innerHTML;
+ } catch(Exception $e) {
+ echo "EXCEPTION IN DOMinnerHTML: ", $e->getMessage();
+ }
}
function endsWith($haystack, $needle) {
$length = strlen($needle);
@@ -64,7 +67,7 @@ Errors:
class itisClient {
private $username;
private $password;
- public $version = array(0, 0, 2);
+ public $version = array(0, 1, 1);
private $programname = "itisclient";
private $programdomain = 'itisclient.sijanec.tk';
private $cookiedir; // set at runtime, ker je get_curerent_user, v login()
@@ -220,7 +223,7 @@ Errors:
curl_setopt($ch, CURLOPT_URL, $personlink);
curl_setopt($ch, CURLOPT_POST, 0);
$request_output = curl_exec($ch);
- file_put_contents("/tmp/69.txt", $request_output);
+ if ($request_output == null) return -6;
$xmlDoc = new DOMDocument($request_output);
$xmlDoc->loadHTML($request_output);
$oseba = array();
@@ -236,9 +239,45 @@ Errors:
if($sn->getAttribute("class") == "nr") $oseba['nr'][] = str_replace(" ", null, strip_tags_content(DOMinnerHTML($sn)));
}
$oseba['nr'] = array_unique($oseba['nr']);
- $oseba['gps'] = get_string_between($ej->getAttribute("href"), 'javascript:openMap(',
- ",'".$oseba['name']);
+ // $oseba['gps'] = get_string_between($ej->getAttribute("href"), 'javascript:openMap(',",&#39;".$oseba['name']);
+ $oseba['gps']['y'] = get_string_between($request_output, '&amp;Y=', '&amp;n=');
+ $oseba['gps']['x'] = get_string_between($request_output, '/zemljevid/X=', '&amp;Y=');
return $oseba;
}
+ public function posljisms($telefonska = "064176345", $prefix = "(poslal itisclient) ", $telo = "itisclient") { // kajsplohiscemo-bool=[0-osebe]/1-podjetja regija-string=[GORENJSKA]/...
+ $ch = $this->login();
+ if(!curl_getinfo($ch)) {
+ if(!empty($ch)){return $ch;}else{return -2;}
+ }
+ curl_setopt($ch, CURLOPT_POST, 0);
+ curl_setopt($ch, CURLOPT_URL, $this->mainpage);
+ $request_init_output = curl_exec($ch);
+ $xmlDoc = new DOMDocument($request_init_output);
+ $xmlDoc->loadHTML( $request_init_output );
+ $searchNode = $xmlDoc->getElementsByTagName("form")[0]->getElementsByTagName( "input" );
+ foreach( $searchNode as $sn ) {
+ if($sn->getAttribute("name") != 'ctl00$CPH_bodyMain$SendSMS$Sender1$btnSend'
+ && $sn->getAttribute("name") != 'ctl00$CPH_bodyMain$SendSMS$Sender1$hfMessage'
+ && $sn->getAttribute("name") != 'ctl00$CPH_bodyMain$SendSMS$Sender1$tbNumber'
+ && $sn->getAttribute("name") != 'ctl00$CPH_bodyMain$SendSMS$Sender1$tbMessage'
+ && $sn->getAttribute("name") != 'ctl00$search$btnSearchAlt'
+ && $sn->getAttribute("name") != 'ctl00$search$btnSearch') {
+ $postvars .= urlencode($sn->getAttribute('name'))."=".urlencode($sn->getAttribute('value')).'&';
+ }
+ }
+ curl_setopt($ch, CURLOPT_POST, 1);
+ // curl_setopt($ch, CURLOPT_HEADER, array('array("Content-Type: multipart/form-data")'));
+ curl_setopt($ch, CURLOPT_URL, $this->mainpageaction);
+ $postbody='__EVENTARGUMENT=&__EVENTTARGET=&'.$postvars.urlencode('ctl00$CPH_bodyMain$SendSMS$Sender1$btnSend').'='.urlencode("Pošlji").'&'.
+ urlencode('ctl00$CPH_bodyMain$SendSMS$Sender1$hfMessage').'='.urlencode($prefix).'&'.
+ urlencode('ctl00$CPH_bodyMain$SendSMS$Sender1$tbNumber').'='.urlencode($telefonska).'&'.
+ urlencode('ctl00$CPH_bodyMain$SendSMS$Sender1$tbMessage').'='.urlencode($telo).
+ '&ctl00%24CPH_bodyMain%24SendSMS%24Sender1%24hfSponsorMessage=a&hiddenInputToUpdateATBuffer_CommonToolkitScripts=1'; // (-;
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $postbody); // THE ANCIENT CODE!
+ $request_output = curl_exec($ch); // https://www.reddit.com/r/ProgrammerHumor/comments/9xat04/the_ancient_code/
+ file_put_contents("/tmp/9.html", $request_output);
+ file_put_contents("/tmp/9.txt", $postbody);
+ return;
+ }
}
?>