Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Shegox authored and Shegox committed Jun 21, 2016
0 parents commit ef6d1db
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 0 deletions.
12 changes: 12 additions & 0 deletions config.php
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";

52 changes: 52 additions & 0 deletions safe_holding.php
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;
}
26 changes: 26 additions & 0 deletions sql.php
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;
}

0 comments on commit ef6d1db

Please sign in to comment.