![]() |
A form of a image class..
Hey!
I'm having a problem.. I wanna code a class, that would let me do something like this: php Code:
And that would search Tibia - Free Multiplayer Online Role Playing Game - News character page for Mortis Dominus, and if it exists, it would do some fetching of the data on that character page, and create an image for it. Character page is: Tibia - Free Multiplayer Online Role Playing Game - Community Then it would echo out a image code, such as "www.domain.com/images/mortis_dominus.png" so I can use it as a dynamic image. How would I achieve this? I know I have to use file_get_contents, and also use the PHP GD library.. I have an example here: Tibia - Character Image |
do we have a form of api for this? ie how do you get the data for the character?
|
with file_get_contents and using preg_match on the resulted page IF the character existed.
Tibia - Free Multiplayer Online Role Playing Game - Community As you see on the link, if you click it, you come to the page with the data of my char.. if you write a char that doesn't exist instead of "Mortis%20Dominus", you won't get that page.. |
1 Attachment(s)
Wrote you a class for this because I'm feeling kind today ;-) ! Don't forget to mention TalkPHP wherever!
php Code:
|
PHP Code:
PHP Code:
|
lol @ sketchmedia
You can even do it in one line: PHP Code:
For another speed boost you should use curl instead of file_get_contents |
Quote:
|
which was precisely why i objected to it in the first place
|
Thanks!!!
I got a question though about your code there.. I suck at those.. preg_replace and that.. And I know I should read about it in some tutorial.. but I just don't.. understand it :( So could someone please explain this to me: PHP Code:
If you go to this site: Tibia - Character Image And enter "Mortis Dominus" as character.. you'll get an image. Also, that image is updated every 10 minutes, how would I achieve that? Thanks alot! |
Oh, and also, how would I get it to include the comments of a player?
Tibia - Free Multiplayer Online Role Playing Game - Community That character has a comment, so how would I include it in the preg_match_all statement?? |
Anyone? xD
|
| All times are GMT. The time now is 08:21 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0