Skip to content

Commit d1c91b0

Browse files
committed
Add files via upload
1 parent abceff3 commit d1c91b0

File tree

1 file changed

+43
-1
lines changed

1 file changed

+43
-1
lines changed

qiwiPaymentClass.php

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,54 @@ public function auth ($login, $password)
8282
}
8383
return 1;
8484
}
85+
86+
//1 today 2 yesterday 3 week
87+
public function history ($type)
88+
{
89+
curl_setopt ($this -> curl, CURLOPT_URL, 'https://qiwi.com/user/report/list.action');
90+
curl_setopt ($this -> curl, CURLOPT_POST, 1);
91+
curl_setopt ($this -> curl, CURLOPT_POSTFIELDS, 'type='.$type);
92+
curl_setopt ($this -> curl, CURLOPT_HTTPHEADER,
93+
array (
94+
'User-Agent Mozilla/5.0 (Windows NT 5.1; rv:38.0) Gecko/20100101 Firefox/38.0',
95+
'Accept:"text/html, */*; q=0.01"',
96+
'Accept-Language:"en-US,en;q=0.5"',
97+
'Accept-Encoding: deflate',
98+
'Content-Type: application/x-www-form-urlencoded; charset=UTF-8',
99+
'X-Requested-With: XMLHttpRequest',
100+
'Referer: https://qiwi.com/report/list.action?type='.$type,
101+
'Connection: keep-alive'
102+
)
103+
);
104+
$cont = curl_exec ($this -> curl);
105+
if (preg_match_all ('|<div class="DateWithTransaction">.*<span class="date">(.*)</span>.*<span class="time">(.*)</span>.*<div class="transaction">(.*)</div>.*</div>|Usi', $cont, $dateWithTransaction) &&
106+
preg_match_all ('|<div class="IncomeWithExpend (.*)">.*<div class="cash">(.*)</div>|Usi', $cont, $incomeWithExpend) &&
107+
preg_match_all ('|<div class="ProvWithComment">.*<div class="provider">.*<span class="opNumber">(.*)</span>.*</div>.*<div class="comment">(.*)</div>|Usi', $cont, $provWithComment))
108+
{
109+
for ($i = 0; $i<count ($dateWithTransaction); $i++)
110+
{
111+
$history [] = array (
112+
'date' => trim ($dateWithTransaction [1][$i]),
113+
'time' => trim ($dateWithTransaction [2][$i]),
114+
'transaction' => trim ($dateWithTransaction [3][$i]),
115+
'type' => trim ($incomeWithExpend [1][$i]),
116+
'cash' => preg_replace('|[^0-9]|', '', $incomeWithExpend [2][$i]),
117+
'number' => trim ($provWithComment [1][$i]),
118+
'comment' => trim ($provWithComment [2][$i])
119+
);
120+
}
121+
return $history;
122+
} else {
123+
return 0;
124+
}
125+
}
85126
}
86127

87128
$qiwi = new qiwiPaymentClass;
88-
if ($qiwi -> auth ('+380688935000', '00000000') == 1)
129+
if ($qiwi -> auth ('+380983700000', '00000000') == 1)
89130
{
90131
echo 'authorized!';
132+
print_r ($qiwi -> history (3));
91133
} else {
92134
echo 'error!';
93135
}

0 commit comments

Comments
 (0)