WarRock Profile Parser - PHP

06/16/2014 22:44 __Buffer#1
Hello everyone, does you have a clan website?

Lazy about being dipendent from other website to get informations from nexon website?

Well, all what you need its this file, my warrock profile parser.

You can find the source code here: [Only registered and activated users can see links. Click Here To Register...]

Don't forget to give proper credits, and to press thanks.

The output will result in a json array, all what you need its use file_get_contents to get your json array.

Array values = nickname, level, kills, deaths, headshots (the percentage), exp, country

Output sample:

PHP Code:
{"nickname":"iRazer","level":"94","kills":"688024","deaths":"323206","headshots":1,"exp":"28856551","country":"Italy"
Please avoid useless replies such as "you can use regex instead of str_replace", i know it but i'm lazy
06/17/2014 13:53 +Yazzn#2
Parsing HTML with RegEx is a bad idea. You should use a XML/HTML parser instead.
06/17/2014 14:21 __Buffer#3
Well, i just made it in 15-30 min, made just for test
06/17/2014 15:15 +Yazzn#4
Why would you make bad code (even if it's "just for test") instead of making good code you can actually use in your products? Actually I don't see what you are testing here. Why would you post code you just made for testing? Just admit that you posted bad code and we'll never speak of it again. :)
06/17/2014 15:42 __Buffer#5
I have nothing to admit, lol, i just made it for test my html code because wa-sta api changed.

I'm not using it lol, i haven't any product where i should put this :p
06/17/2014 16:35 AmazingTurtle#6
Quote:
Originally Posted by Peter File View Post
Parsing HTML with RegEx is a bad idea. You should use a XML/HTML parser instead.
Have a closer look: He's actually not using RegEx. Even worse - split the string and replaced not required data...
Btw [Only registered and activated users can see links. Click Here To Register...] seems really nice O: I may use this for template-processing purpose in future, too
06/17/2014 17:06 +Yazzn#7
I know that he is not using RegEx but he thinks it's good to use it.

Quote:
Originally Posted by __Buffer
Please avoid useless replies such as "you can use regex instead of str_replace", i know it but i'm lazy
06/17/2014 17:57 Sleutel#8
Quote:
Originally Posted by Peter File View Post
Parsing HTML with RegEx is a bad idea. You should use a XML/HTML parser instead.
Well okay thanks for the reply. This is a perfect example how it goes in this stupid community. Someone releases something an immediately the others start to tell how to do it better. If you claim you can do it better, write it yourself. It works, if you don't need to make a lot of requests then stick with it else you should considering optimizing the code or even rewriting it.

@ToXiiC Thanks for the release!
06/17/2014 18:14 AmazingTurtle#9
:facepalm: Constructive criticism should be accepted, not declined. Why don't you apply his suggesstions to your code? It's free advice to you, guys! Keep in mind: We don't want to hurt your feelings *lol*, we want you to feel yourself happier when you've written a better code. *lolē*
06/17/2014 20:05 +Yazzn#10
@Sleutel That's what a forum is for: Discussion. You feel uncomfortable with that? Feel free to leave.
06/17/2014 20:56 Sleutel#11
Quote:
Originally Posted by /bin/cat View Post
:facepalm: Constructive criticism should be accepted, not declined. Why don't you apply his suggesstions to your code? It's free advice to you, guys! Keep in mind: We don't want to hurt your feelings *lol*, we want you to feel yourself happier when you've written a better code. *lolē*
Well this below post doesn't seem very constructive in my eyes does it in yours?

Quote:
Originally Posted by Peter File View Post
Why would you make bad code (even if it's "just for test") instead of making good code you can actually use in your products? Actually I don't see what you are testing here. Why would you post code you just made for testing? Just admit that you posted bad code and we'll never speak of it again. :)
If you really are positive then you would congratulate him for writing the code not telling him his code is bad. You should read a couple articles before you claim that code his code is bad. I bet you wrote bad code yourself. It's very destructive if you tell that someone code is bad. In my opinion is it good code because he wrote working code for the little knowledge he has of PHP. I know there are many solutions for solving problems but remember your solution isn't always the best. He did a great job of programming this.

Here is a perfect example:

Quote:
Originally Posted by Peter File View Post
@Sleutel That's what a forum is for: Discussion. You feel uncomfortable with that? Feel free to leave.
Your argument is invalid since you generalize it and second you are aiming for me instead of my argument I gave. If you really want to discuss this then at least provide valid arguments and be positive :)
06/17/2014 21:17 lKasma#12
I think that your source code will be useful for "coders", so... They should say thank you for this release. :p
06/17/2014 22:18 +Yazzn#13
Quote:
Originally Posted by Sleutel
It's very destructive if you tell that someone code is bad
Actually it's quite the opposite. I said his code is bad but I also told him how to improve it.

[Only registered and activated users can see links. Click Here To Register...]

Quote:
Originally Posted by Sleutel
You should read a couple articles before you claim that code his code is bad
So you are suggesting that my advice is wrong?

Quote:
Originally Posted by Sleutel
I know there are many solutions for solving problems but remember your solution isn't always the best.
My proposed solution is the best one I know. If you find a better solution that's fine but one thing I can say for sure: My solution is better than his solution.

Quote:
Originally Posted by Sleutel
In my opinion is it good code because he wrote working code for the little knowledge he has of PHP. [...] He did a great job of programming this.
It's bad code. If he has little knowledge of PHP he should be glad I give him advice. There's nothing wrong in giving advice.

Quote:
Originally Posted by Sleutel
Your argument is invalid since you generalize it and second you are aiming for me instead of my argument I gave. If you really want to discuss this then at least provide valid arguments and be positive
What argument?

And why did you post a video about micro optimization again?
06/17/2014 23:26 __Buffer#14
Well, my purpose was to make it working, not for making it 100% perfect coding, but i just posted here to share so you can avoid to be dependent from other websites (except the nexoneu of course)

You can use it storing everyday new searches (like the old warrock stats) so you will have your own database with all users informations.

So if the nexon eu website its offline or under maintenance you will not get any error
06/18/2014 10:53 Sleutel#15
Quote:
Originally Posted by Peter File View Post
So you are suggesting that my advice is wrong
I didn't say your advice is wrong but the way you did it. I'm not talking about your first post but I'm talking about your second one. It's very rude to tell someones code is bad in the way you did it.