<?php $source = get_page("http://ops.warrock.net/ShowClan.aspx?c=578"); $clan_name = "The Stealth Elite"; $record = preg_split(record); $World_rank = "blah"; $Region_rank = "blah"; print "Clan : $clan_name<br> Record : $record<br> World Rank : $world_rank<br> Region Rank : $Region_rank"; ?>
This is what i have so far for $record, $World_rank and $Region_rank i am trying to use preg_split to take data from the source and use it as a variable. However i dont have a clue how this is done.
Well for one, PCRE regular expression patterns must have delimiters.
Perhaps you should explain to us exactly what data you're trying to scrape from that page instead?
on http://ops.warrock.net/ShowClan.aspx?c=578 there is a bit near the top that says record world rank and regoin rank this is what i am wanting.
You could try something like:
$pattern = '/Record: ([0-9-]+).*?World Rank: ([0-9]+).*?Regional Rank: ([0-9]+)/'; preg_match($pattern, $source, $matches); list(, $record, $world_rank, $regional_rank) = $matches;
(Untested)
kk i have this now
<?php $source = file_get_contents('http://ops.warrock.net/ShowClan.aspx?c=578'); $pattern = '/Record: ([0-9-]+).*?World Rank: ([0-9]+).*?Regional Rank: ([0-9]+)/'; preg_match($pattern, $source, $matches); list(, $record, $world_rank, $regional_rank) = $matches; $clan_name = "The Stealth Elite"; echo "Clan : $clan_name<br> Record : $record<br> World Rank : $world_rank<br> Region Rank : $Region_rank<br><br>Script Created By Arkismad.."; ?>
which outputs with this http://4f-scotland.com/test.php were to go from here ?
Ah, my mistake, forgot to add the 's' modifier to the pattern... add an 's' after the ending '/' and it should work fine. Note that I used $regional_rank in the list(), so you'll have to change the echo() (or the list()... either way, they have to be the same variable, obviously).
kk il give it a try
EDIT: yea thanks works now.