-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Shegox
authored and
Shegox
committed
Jun 21, 2016
0 parents
commit ef6d1db
Showing
3 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
|
||
//SQL server | ||
$DATABASE = "eve_wallet"; | ||
$USER = "username"; | ||
$PASSWORD = "userpassword"; | ||
|
||
// API KEY | ||
$API_KEYID = "corpApiKey"; | ||
$API_vCode = "CorpVCode"; | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
include_once "sql.php"; | ||
include_once "config.php"; | ||
|
||
$journal = getFullWallet(); | ||
|
||
foreach ($journal as $row) | ||
{ | ||
print_r($row); | ||
$sql = "INSERT INTO `we_still_breastfeed`(`date`,`refID`,`refTypeID`,`ownerName1`, `ownerID1`, `ownerName2`, `ownerID2`, `argName1`, `argID1`, `amount`, `balance`, `reason`, `owner1TypeID`, `owner2TypeID`) VALUES ('{$row["date"]}','{$row["refID"]}','{$row["refTypeID"]}','{$row["ownerName1"]}', '{$row["ownerID1"]}', '{$row["ownerName2"]}', '{$row["ownerID2"]}', '{$row["argName1"]}', '{$row["argID1"]}', '{$row["amount"]}', '{$row["balance"]}', '{$row["reason"]}', '{$row["owner1TypeID"]}', '{$row["owner2TypeID"]}')"; | ||
echo $sql; | ||
var_dump(sql_write($sql)); | ||
} | ||
|
||
function getFullWallet() | ||
{ | ||
$journal = []; | ||
$data = getWallet(999999999999999); | ||
while ($data->row->count() > 0) | ||
{ | ||
|
||
foreach ($data->row as $row){ | ||
array_push($journal,$row); | ||
} | ||
|
||
$data = getWallet($row["refID"]); | ||
} | ||
return $journal; | ||
} | ||
|
||
function getWallet($tranID){ | ||
$url = "https://api.eveonline.com/corp/WalletJournal.xml.aspx?keyID={$GLOBALS["API_KEYID"]}&vCode={$GLOBALS["API_vCode"]}&rowCount=2560&accountKey=1000&fromID=$tranID"; | ||
$ch = curl_init(); | ||
curl_setopt($ch, CURLOPT_URL, $url); | ||
// Set so curl_exec returns the result instead of outputting it. | ||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | ||
// Does not verify peer | ||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); | ||
// Get the response and close the channel. | ||
$headers = Array( | ||
"Reddit: Shegox", | ||
"IGN: Shegox Gabriel" | ||
); | ||
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); | ||
curl_setopt($ch, CURLOPT_ENCODING, "gzip"); | ||
|
||
$response = curl_exec($ch); | ||
curl_close($ch); | ||
$response = simplexml_load_string($response); | ||
$response = $response->result->rowset; | ||
return $response; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
include_once "config.php"; | ||
|
||
function sql_read($sql) | ||
{ | ||
$conn = connect(); | ||
$result = $conn->query($sql); | ||
$result = $result->fetch_all(MYSQLI_BOTH); | ||
$conn->close(); | ||
return $result; | ||
} | ||
|
||
function sql_write($sql) | ||
{ | ||
$conn = connect(); | ||
$result = $conn->query($sql); | ||
$conn->close(); | ||
return $result; | ||
} | ||
|
||
function connect() | ||
{ | ||
$conn = new mysqli ('localhost', $GLOBALS["USER"], $GLOBALS["PASSWORD"], $GLOBALS["DATABASE"]); | ||
print_r($conn); | ||
return $conn; | ||
} |