Pages: [1] :: one page |
|
Author |
Thread Statistics | Show CCP posts - 0 post(s) |
Whitney Aubaris
AWOLGamers
3
|
Posted - 2017.01.18 10:41:33 -
[1] - Quote
Smart PHP coders I seek your knowledge.
So I'm having problems populating my corp market orders list with the names of the items listed.
This is what I have so far and it works though I know I did something wrong because it times out after just the first few items. https://gist.github.com/AWOLTheSquatch/e1922d54ce1739e105eae03dfd5d5365
Thank you for your help in advance. o7 |
Whitney Aubaris
AWOLGamers
3
|
Posted - 2017.01.19 04:33:17 -
[2] - Quote
No one has any idea? I provided a fully functional code. If you have server that supports PHP you can run the script and see the results. If you don't have corp access just change the /corp/ to /char/ in the URLs and it will give the same info for your personal items. |
Blacksmoke16
Resilience.
43
|
Posted - 2017.01.19 05:27:50 -
[3] - Quote
Some tips that might be better are to just create an array with all the typeIDs from the marketOrders API and then do them all in a big batch. This will lead to faster load times as less requests will be required.
Another option and probably better one is to just use the SDE invTypes table vs using an XML endpoint to get typeNames.
I'll mess with your script and see what i can do. Will edit post if i find something. |
Steve Ronuken
Fuzzwork Enterprises Vote Steve Ronuken for CSM
6391
|
Posted - 2017.01.19 12:45:59 -
[4] - Quote
I highly recommend, for this kind of usage, loading up invTypes somewhere.Sure, you'll need to update it once per release, but it'll massively cut down on the workload.
https://www.fuzzwork.co.uk/dump/
Mysql is my normal choice. (Postgres is better, but mysql is more common)
Woo! CSM XI!
Fuzzwork Enterprises
Twitter: @fuzzysteve on Twitter
|
Whitney Aubaris
AWOLGamers
6
|
Posted - 2017.01.28 12:44:24 -
[5] - Quote
Blacksmoke16 wrote:Some tips that might be better are to just create an array with all the typeIDs from the marketOrders API and then do them all in a big batch. This will lead to faster load times as less requests will be required.
Another option and probably better one is to just use the SDE invTypes table vs using an XML endpoint to get typeNames. Despite my Negative SP in PHP I have managed to get a file_put_contents scripts to work and I have been manually caching all the API's I need into API documents. My site loads almost instantly on every page now.
The only real problem I'm having with the cached API's for the typeID / Name is the max cash allowed is 250 items for the first cache and 200 items for every cache after that. Well I guess that's not the real problem though it is related. Because of the limit on how many items can be requested I am running more than one API caching file that Is adding to the same cached API file to create the full typeID / Name list in one document. The dilemma is the code in the following link at lines 256 to 263 gets added in to the document between every API that was cached to the file. You can see even more further down the page.
https://gist.github.com/AWOLTheSquatch/da7b40f2211b5125f4ab55a1c97083db
This link shows all the code from two of the files that save the API to a file. https://gist.github.com/AWOLTheSquatch/afc9433d049738ca8ee344e7d188d769
Steve Ronuken wrote:I highly recommend, for this kind of usage, loading up invTypes somewhere.Sure, you'll need to update it once per release, but it'll massively cut down on the workload. https://www.fuzzwork.co.uk/dump/ Mysql is my normal choice. (Postgres is better, but mysql is more common) I would love to cache all my API data to my MySQL server but I have been 100% unsuccessful in even getting anything to save to the database for the API's.
For everyone that thinks I just don't know how to use an SQL server. Yes I use to host lots of servers that used MySQL and I was vary successful with operating the SQL servers for them. So I would like to think I know what I'm doing in that regard.
I just don't get it. All the toots I have read just get me lost. I'm a hands on type of guys. Walk me though it once maybe twice and I can run with it on my own with a few questions here and there. :( I wish I could read something and understand it like most people.
So if there is any simple code a newb can understand that will import my API into a SQL I would be forever grateful. Note the link you gave me to your dump has me 110% lost and confused. Sorry. :( |
Althalus Stenory
Flying Blacksmiths
104
|
Posted - 2017.01.31 12:30:32 -
[6] - Quote
In really short, after you created your tables, in your php:
// connect to your database $db = new PDO('mysql:host=localhost;dbname=youdatabasename;charset=utf8', 'user', 'password');
// prepare your query $query = $db->prepare('INSERT INTO youtable (column1, column2) values (:val1, :val2)');
// fill the values and execute $req->execute(array( 'val1' => 'whatever you want', 'val2' => 12345 ));
you could also do "->query()" instead of prepare/execute, but iirc prepare/execute may escape the values (I might be wrong since I didn't php for some years). But you get the idea :)
This might help you too : https://phpdelusions.net/pdo
EsiPy - Python 2.7 / 3.3+ Swagger Client based on pyswagger for ESI
|
Whitney Aubaris
AWOLGamers
6
|
Posted - 2017.01.31 21:33:57 -
[7] - Quote
Althalus Stenory wrote:In really short, after you created your tables, in your php: // connect to your database $db = new PDO('mysql:host=localhost;dbname=youdatabasename;charset=utf8', 'user', 'password');
// prepare your query $query = $db->prepare('INSERT INTO youtable (column1, column2) values (:val1, :val2)');
// fill the values and execute $req->execute(array( 'val1' => 'whatever you want', 'val2' => 12345 ));
you could also do "->query()" instead of prepare/execute, but iirc prepare/execute may escape the values (I might be wrong since I didn't php for some years). But you get the idea :) This might help you too : https://phpdelusions.net/pdo Thank you I am definitely going to give this a go.
Your code was vary easy to understand with good notes. I will let you know how it works for me in. |
|
|
|
Pages: [1] :: one page |
First page | Previous page | Next page | Last page |