-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconvertdollartorupiah.php
47 lines (38 loc) · 1 KB
/
convertdollartorupiah.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
<?php
require_once('vendor/autoload.php');
use DiDom\Document;
/**
*
*/
class ConvertDollarRupiah
{
function __construct()
{
#
}
private function curi()
{
$url = 'https://kursdollar.net/real-time/USD/';
$document = new Document($url, true);
$kurs = $document->find('td')[3];
// var_dump($kurs);
return $kurs;
}
public function run()
{
$rupiah = str_replace(' ', '', $this->curi()->text());
$rupiah = doubleval($rupiah);
echo "===========================================\n";
echo "[+] Status => ".$this->curi()->text()."/USD\n";
echo "===========================================\n";
echo "[-] Jumlah USD : ";
$parameter_dollar = trim(fgets(STDIN));
sleep(3);
echo "===========================================\n";
$convert = $parameter_dollar * $rupiah;
echo "[=] Convert ".$parameter_dollar." Dollar => Rp.".$convert."\n";
echo "===========================================\n";
}
}
$t = new ConvertDollarRupiah;
$t->run();