Jump to content

Recommended Posts

Page I am parsing: http://steamcommunity.com/profiles/76561198010758659/games?tab=all

Goal:  I am trying to pull a list of hours from the div "game_440"  which is Team Fortress 2

Details: Team Fortress 2 has a div ID of game_440. The hours has a heading of <H4> within that div

 

So far I have

$html = file_get_dom('http://steamcommunity.com/profiles/76561198010758659/games?tab=all');
    	echo $html('div#game_440', 0)->getPlainText();

 

But this outputs more information then I would like as I only want the hours. Not everything else.

Team Fortress 2 1951.6 hrs on record Links Visit the Forums Find Community Groups Visit official website Read related news View Stats »๖ۣۜMr.๖ۣۜTeemo™ Achievements »๖ۣۜMr.๖ۣۜTeemo™ Stats Global Achievements Global Leaderboards Recommend... 

 

 

 

 

Also, I am hoping for one of two things. Either to be able to pull the links it parses from a list in a text file of full URL's like so

$html = file_get_dom('listoflinks.txt');
    	echo $html('div#game_440', 0)->getPlainText();

 

Or the ability to have it pull JUST the ID number so I dont have to get the full link

$html = file_get_dom('http://steamcommunity.com/profiles/[get:link.no.from.txt]/games?tab=all'');
    	echo $html('div#game_440', 0)->getPlainText();

 

Either one of these is acceptable, I don't care which one.

Thanks for the help

Link to comment
https://forums.phpfreaks.com/topic/256065-parsing-a-heading-within-a-div/
Share on other sites

Well, aint that nice xD I am new to PHP so I did not know I could do that =)

Thanks for that one. Now all I need to do is learn how to parse from a list of URL's

Which there seems to be a serious lack of assistance available for this online. Maybe it can't be done.

Yeah, I know it has to do with DOM. I am using it already to get what I had to begin with. Your script worked like a charm.

I am going to research array's now. Also, I have one more thing I am hoping to do eventually.

 

At this moment, it outputs plaintext. Which is great, but if I could get it to also output the link which provided the results at the end of each result that would also be great =)

I am going to research a bit and see what I can figure out first

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.