Last active
July 31, 2018 21:06
-
-
Save mangadul/31d23afc7f73447ba64bcc3b605afa01 to your computer and use it in GitHub Desktop.
Massive BOT token Give Away sending payment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Description: | |
Massive BOT token Give Away sending payment. | |
Stellar bridge-server (https://github.com/stellar/bridge-server) must be installed before use this code. | |
Reff: https://github.com/stellar/bridge-server/blob/master/readme_bridge.md | |
Written By: @mangadul (admin@bostravel.online) | |
(c) 2018 - bostravel.online | MIT License | |
Example Success Result: | |
------------------------ | |
{ | |
"hash": "b5d7d7ff8e7cbaa20bd1c0de92bf6a609995e4edc2cd927341df01c51001a7de", | |
"result_xdr": "AAAAAAAAAGQAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAA=", | |
"ledger": 19218956 | |
} | |
Example Error Result: | |
------------------------ | |
command to post or parameter invalid or empty -> | |
{ | |
"code": "internal_server_error", | |
"message": "Internal Server Error, please try again." | |
} | |
empty input parameter -> | |
{ | |
"code": "missing_parameter", | |
"message": "Required parameter is missing.", | |
"data": { | |
"name": "destination" | |
} | |
Invalid transaction sequence -> | |
{ | |
"code": "transaction_bad_seq", | |
"message": "Bad Sequence. Please, try again." | |
} | |
*/ | |
define("PVKWALLET", ""); | |
define("ASSET_CODE", "BOT"); | |
define("ASSET_ISSUER", "GATTH3VPK4PMXLE7JSEJ3OC72OYOGJYINLHSCJX365BP6SAV6GKSHJAV"); | |
define("BRIDGE_SERVER", "http://localhost:8006/payment"); | |
$handle = fopen("massbot.txt", "r"); | |
if ($handle) { | |
while (($line = fgets($handle)) !== false) { | |
$account = trim(preg_replace('/\s+/', '', $line)); | |
if(!empty($account)) | |
{ | |
payment($account, 100, "ADDITIONAL BOT TOKEN"); | |
} | |
} | |
fclose($handle); | |
} else { | |
die("File not found or can not be opened."); | |
} | |
function payment($account, $amount, $memo){ | |
$ch = curl_init(); | |
$data_string = sprintf("source=%s&amount=%d&destination=%s&asset_code=%s&asset_issuer=%s&memo_type=text&memo=%s", PVKWALLET, $amount, $account, ASSET_CODE, ASSET_ISSUER, $memo); | |
curl_setopt($ch, CURLOPT_URL, BRIDGE_SERVER); | |
curl_setopt($ch,CURLOPT_USERAGENT,'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36'); | |
curl_setopt($ch, CURLOPT_POST, 1); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, sprintf("%s", $data_string)); | |
curl_setopt($ch, CURLOPT_HEADER, true); | |
curl_setopt($ch, CURLOPT_VERBOSE, 0); | |
curl_setopt($ch, CURLOPT_HTTPHEADER, | |
array('Content-Type: application/x-www-form-urlencoded', | |
'Content-Length: ' . strlen($data_string), | |
'Connection: Keep-Alive') | |
); | |
// receive server response ... | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
$server_output = curl_exec($ch); | |
$header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE); | |
$header = substr($server_output, 0, $header_size); | |
$body = substr($server_output, $header_size); | |
curl_close ($ch); | |
$out = $body; | |
echo $account, " -> ", $out, "\n"; | |
// $arrjson = json_decode($out, true); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment