Jump to content

[SOLVED] Parsing Data From Remote Sites


tail

Recommended Posts

My subject is that I want to put titles, descriptions, and content from another website and to present them in mine. Can somebody explain to me how to do this? I've read you can do this using fopen and preg_match, but I'm not sure how to implement it.

Link to comment
Share on other sites

My subject is that I want to put titles, descriptions, and content from another website and to present them in mine. Can somebody explain to me how to do this? I've read you can do this using fopen and preg_match, but I'm not sure how to implement it.

 

Depending on the site you can use file_get_contents or, if the site requires posts (i.e. login), you would have to use cURL.

 

The first option would look something similar to:

 

$url= "http://www.blah.com";
$conn = fopen($url, "r");
$html = file_get_contents($url);
fclose($conn);
echo $html; 

?>

Link to comment
Share on other sites

The first option would look something similar to:

 

<?php

$url= "http://www.blah.com";
$conn = fopen($url, "r");
$html = file_get_contents($url);
fclose($conn);
echo $html; 

?>

 

@Maq, yeah but the

$conn = fopen($url, "r");

and

fclose($conn);

are not required!

unless your using fread(), and only reading a small chunk

;)

 

tail what data do you wish to extract, can you post some sample of what $html returns and what part you want from it

Link to comment
Share on other sites

Code:

<?php
$url= "http://www.bigfuntown.com/Game-1497.html";
$conn = fopen($url, "r");
$html = file_get_contents($url);
fclose($conn);
echo $html;
?>

Output:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><link href="/Scripts/style20090313.css" type="text/css" rel="stylesheet" />
    <script src="/Scripts/BigFunTown20090321.js" type="text/javascript"></script>
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" /><meta name="description" content="Play the free online arcade game Spark at Big Fun Town. The Orion I was on its maiden voyage to another planet and was show down by a planetary defense system. You were a maintenance worker aboard the Orion I known as Spark." /><title>
Spark
</title></head>
<body onload="rearrangePage();">
    <form name="aspnetForm" method="post" action="http://www.bigfuntown.com/Game-1497.html" id="aspnetForm" onsubmit="return Page_OnSubmit();">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKLTY2MjY3MDIxOGQYAQUpY3RsMDAkTWFpbiRHYW1lSW5mb3JtYXRpb24kR2FtZUNhdGVnb3JpZXMPPCsACgIHFCsAA2RkZAgCA2R3rA6vY/kECFIFlBTP+X/tW8qGeA==" />

<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWAwKSypvjDgLImuiGCAK07NioCzy5pEoIUeTRTpus8Bkq1baZZIrv" />
        <div id="pageBlock" class="centerblock">            
            <table id="ctl00_mainTable" class="main">

<tr>
	<td class="content">
                        <div id="topContent">
                            <div class="header">
                                <table style="margin: auto auto;"><tr>
                                <td><a id="ctl00_URLHome" href="/Default.html"><img src="/App_Themes/Default/images/logo.png" alt="Play Free Online Games at Big Fun Town" border="0" /></a></td>
                                <td>

<table>
    <tr>

        <td style="padding-left: 1.5em;">
            <a id="ctl00_ctl12_URLLogin" href="/Login.html"><img src="/App_Themes/Default/images/guest.png" alt="Guest's Avatar" border="0" /></a>
        </td>
        <td style="text-align: center;">
            <div style="font-size:1.5em; padding-top: 0.7em; padding-bottom: 0.7em;">
                <a id="ctl00_ctl12_URLLogin2" href="/Login.html">Login</a>
            </div>
            <div>

                <a id="ctl00_ctl12_URLRegister" href="/SignUp.html">Sign Up</a>
            </div>
        </td>
    </tr>
</table></td>
                                </tr></table>                             
                            </div>

                            <hr />

                            <span id="ctl00_Breadcrumb" style="float:left; padding-bottom: 0.5em;"><span><a title="Home" href="./">Home</a></span><span> > </span><span><a>Games</a></span><span> > </span><span>Spark</span></span>
                            
                            <div style="float:right; position: relative; top: -0.1em;">

                                <input name="ctl00$SearchQuery" type="text" value="enter gamename" id="ctl00_SearchQuery" class="hintField" onFocus="focusHintField(this, 'enter gamename');" onBlur="blurHintField(this, 'enter gamename');" />
                                <input type="submit" name="ctl00$SearchButton" value="Search" id="ctl00_SearchButton" />
                            
	</div>     
                            
                            <hr style="clear:both;" />

                            
                            <iframe frameborder="0" marginheight="0" marginwidth="0" scrolling="no" src="/Includes/topb.html" width="728px" height="90px" style="text-align: center;">
                                <script type="text/javascript"><!--
                                google_ad_client = "pub-3225396957957589";
                                google_ad_slot = "2475441297";
                                google_ad_width = 728;
                                google_ad_height = 90;
                                //-->
                                </script>
                                <script type="text/javascript"
                                src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
                                </script>
                            </iframe>
                        </div>
                        
                        

<div style="margin-top: 0.4em;"></div>
                    	
            	        
            
    <h1 id="game">Spark</h1>   
    
    <div class="toolbar">
        <a href="#sharegame">Tell your Friends</a> 
        
            | <a href="#instructions">Game Instructions</a> 
        
            <script type="text/javascript" language="javascript">
                var gameid = 1497;
            </script>

            | <span id="rateGameArea">
            Rate this Game 
            <img id="star1" onmouseover="rateOver(1);" onmouseout="rateOut();" onclick="rate(1)" src="App_Themes/Default/images/starEmpty.gif" style="cursor: pointer;" />
            <img id="star2" onmouseover="rateOver(2);" onmouseout="rateOut();" onclick="rate(2)" src="App_Themes/Default/images/starEmpty.gif" style="cursor: pointer;" />
            <img id="star3" onmouseover="rateOver(3);" onmouseout="rateOut();" onclick="rate(3)" src="App_Themes/Default/images/starEmpty.gif" style="cursor: pointer;" />
            <img id="star4" onmouseover="rateOver(4);" onmouseout="rateOut();" onclick="rate(4)" src="App_Themes/Default/images/starEmpty.gif" style="cursor: pointer;" />
            <img id="star5" onmouseover="rateOver(5);" onmouseout="rateOut();" onclick="rate(5)" src="App_Themes/Default/images/starEmpty.gif" style="cursor: pointer;" />
            </span>

            
            | <img onclick="gameSmaller();" src="/App_Themes/Default/images/magnifyingGlassMinus.jpg" alt="Zoom Out" border="0" style="cursor: pointer;" /><img onclick="gameLarger();" src="/App_Themes/Default/images/magnifyingGlassPlus.jpg" alt="Zoom In" border="0" style="cursor: pointer;" />
    </div>
    
    
    <style>.gameObj { width: 40em; height: 30em; }</style><script type="text/javascript">if(screen.width < 850) { var gameRule = findStyleRule(".gameObj");gameRule.width = parseFloat(gameRule.width) * 0.93 + "em";gameRule.height = parseFloat(gameRule.height) * 0.93 + "em";}</script><div id="leaderboard_bridge"></div><script src="http://xs.mochiads.com/static/pub/swf/leaderboard.js" type="text/javascript"></script><script type="text/javascript">var options = {partnerID: "97aca1794f954f3c", id: "leaderboard_bridge"};options.username = "* Guest 2073";options.userPrefix = "http://www.bigfuntown.com/User.html?name=";options.logoURL = "http://www.bigfuntown.com/App_Themes/Default/images/logo1616.jpg";options.siteURL = "http://www.bigfuntown.com";options.siteName = "Big Fun Town";options.callback = function(params) {var url = "/SiteFunctions.asmx/MochiScore";var parameters = "gameID=1497&mochiID=" + escape(params.boardID) + "&title=" + escape(params.title) + "&description=" + escape(params.description) + "&scoreName=" + escape(params.scoreLabel) + "&dataType=" + escape(params.datatype) + "&sortOrder=" + escape(params.sortOrder) + "&score=" + escape(params.score) + "&username=" + escape(params.username);var encoding = hex_md5("1497" + params.boardID + params.title + params.description + params.scoreLabel + params.datatype + params.sortOrder + params.score + params.username);parameters = parameters + "&encoding=" + escape(encoding);ajaxRequest(url, parameters, null, sendRequest);};Mochi.addLeaderboardIntegration(options);</script><div style="margin: 0px; padding: 0px; margin-bottom: 1em;"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" class="gameObj"><param name="movie" value="/Games/1497.swf" /><param name="allowScriptAccess" value="sameDomain" /><param name="quality" value="high" /><embed src="/Games/1497.swf" quality="high" class="gameObj" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object></div>
            
    <div class="centerblock">
        <div id="bottomBanner" style="width:728px;">
            <iframe id="bottomBannerFrame" frameborder="0" marginheight="0" marginwidth="0" scrolling="no" src="Includes/botb.htm" width="728px" height="90px">
                <script type="text/javascript"><!--
                google_ad_client = "pub-3225396957957589";
                google_ad_slot = "8089773714";
                google_ad_width = 728;
                google_ad_height = 90;
                //-->
                </script>
                <script type="text/javascript"
                src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
                </script>
            </iframe>

        </div>
    </div>
    
    
    <h1>Similar Games</h1>
    
    
        <table class="games">
            
        <tr>
            
        <td>
            <a href="/Game-610.html"><img src="/Games/610.jpg" alt="The Island Game" border="0" style="width:10em; border-width:0px;" /></a>
            <a href="/Game-610.html">The Island</a>

        </td>
    
        <td>
            <a href="/Game-1177.html"><img src="/Games/1177.jpg" alt="UFO Assault Game" border="0" style="width:10em; border-width:0px;" /></a>
            <a href="/Game-1177.html">UFO Assault</a>
        </td>
    
        <td>
            <a href="/Game-927.html"><img src="/Games/927.jpg" alt="Bridges Game" border="0" style="width:10em; border-width:0px;" /></a>
            <a href="/Game-927.html">Bridges</a>

        </td>
    
        </tr>
    
        </table>
    

    
    <div id="bottomTextLinks" style="position: relative; top: -0.4em;">
    <script type="text/javascript"><!--
    google_ad_client = "pub-3225396957957589";
    google_ad_slot = "8535363487";
    google_ad_width = 728;
    google_ad_height = 15;
    //-->
    </script>
    <script type="text/javascript"
    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
    </div>
    
  
    
    


<h1>Spark Game Information</h1>

<div style="width: 300px; height: 250px; float: right; margin-left: 1em; margin-bottom: 1em;">
<iframe frameborder="0" marginheight="0" marginwidth="0" scrolling="no" src="/Includes/box.html" width="300px" height="250px">
<script type="text/javascript"><!--
google_ad_client = "pub-3225396957957589";
google_ad_slot = "6705097049";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</iframe>
</div>    
    
Played 163 times<br />

Average Score: 
1.50 / 5.00 (from 2 votes)


<br />

Date Added: 4 June 2009<br />

Categories: 

        
        <a id="ctl00_Main_GameInformation_GameCategories_ctrl0_HyperLink1" href="/Category-23.html">High Score</a>, 
        <a id="ctl00_Main_GameInformation_GameCategories_ctrl2_HyperLink1" href="/Category-7.html">Platform</a>, 
        <a id="ctl00_Main_GameInformation_GameCategories_ctrl4_HyperLink1" href="/Category-9.html">Shooting</a>

    <br />

<a id="ctl00_Main_GameInformation_ShowHighScores" href="/GameScores-1497.html">Spark High Scores</a><br />


<h2 id="instructions" style="width: 50%;">Description</h2>
<div class="h2content">
    <span id="ctl00_Main_GameInformation_GameDescription">The Orion I was on its maiden voyage to another planet and was show down by a planetary defense system. You were a maintenance worker aboard the Orion I known as Spark. It's up to you to explore this new planet using your maintenance vehicle. There are 20 levels to complete on this alien planet that involve finding your way to the exit, destroying enemies, collecting objects, avoiding dangerous obstacles, and more.</span>
</div>


    <h2 style="width: 50%;">Game Play Instructions</h2>

    <div class="h2content">
        <span id="ctl00_Main_GameInformation_GameInstructions">Move using the WASD keys, toggle your tractor beam on/off using the Z key. Cycle through the available weapons using the Q and E keys or the MOUSE WHEEL. You can also change weapons using the 1-9 number keys. Aim using the MOUSE and fire using the LEFT MOUSE BUTTON. Also use the LEFT MOUSE BUTTON to interact with switches. Pause the game using the P key and toggle the radar on/off using the R key. Move using the ARROW keys while in radar mode.</span>
    </div>


<br /><a href="#game">Back to game</a> 
    <br /><br />
    
    

<h1 id="sharegame" style="clear:both;">Share Spark with your Friends</h1>
    
<h2>via Email</h2>

<div class="h2content">
    <a id="ctl00_Main_ShareGame_UrlEmailFriends" onclick="javascript:pageTracker._trackPageview('/tellafriend/Game-1497');" href="mailto:?subject=Play Spark Game&body=Hi,%0D%0DI just found this fun game, click below to play Spark.%0Dhttp://www.bigfuntown.com/Game-1497.html">Click here to send Spark to your friends using your default email program.</a>
</div>

<h2>via Webmail (Gmail, Hotmail, Yahoo! Mail, etc.)</h2>
<div class="h2content">
    Copy (Ctrl+C) and paste (Ctrl+V) the link below into your webmail and send it to your friends<br /><br />
    <textarea cols="45" rows="1" onclick="this.select();" readonly="readonly" style="overflow:hidden;">http://www.bigfuntown.com/Game-1497.html</textarea>
</div>

<h2>via Website, Blog, or Social Networking</h2>
<div class="h2content">
    <div style="float:right; margin-top: 1em; margin-left: 1em; ">
        <span style="text-decoration: underline;">Game Code Preview</span>   
        <div style="text-align:center;"><a href="http://www.bigfuntown.com/Game-1497.html">Play Spark</a><br /><a href="http://www.bigfuntown.com/Game-1497.html"><img src="http://www.bigfuntown.com/Games/1497.jpg" width="150px" /></a><br/><a href="http://www.bigfuntown.com/Game-1497.html">Play Free Game</a></div>
    </div>
    
    Copy (Ctrl+C) and paste (Ctrl+V) the code below onto your website, blog, or social networking profile<br /><br />
    <textarea cols="30" rows="3" onclick="this.select();" readonly="readonly" style="overflow:hidden;"><div style="text-align:center;"><a href="http://www.bigfuntown.com/Game-1497.html">Play Spark</a><br /><a href="http://www.bigfuntown.com/Game-1497.html"><img src="http://www.bigfuntown.com/Games/1497.jpg" width="150px" /></a><br/><a href="http://www.bigfuntown.com/Game-1497.html">Play Free Game</a></div></textarea>

</div>

<br /><a href="#game">Back to game</a>       
    

                        
                        <br style="clear: right;" />
                        
                         
                    </td>
	<td id="ctl00_mainSidebar" class="sidebar"> 
                        <iframe frameborder="0" marginheight="0" marginwidth="0" scrolling="no" src="/Includes/skyb.html" width="160px" height="600px">
                            <script type="text/javascript"><!--
                            google_ad_client = "pub-3225396957957589";
                            google_ad_slot = "8100818846";
                            google_ad_width = 160;
                            google_ad_height = 600;
                            //-->
                            </script>
                            <script type="text/javascript"
                            src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
                            </script>
                        </iframe>
                        
                        <br />                             
                                                                  
                        
                        
                        

<h1>Categories</h1>
    

        <a href="/Category-1.html">Action</a> (217)<br />

    
        <a href="/Category-13.html">Adventure</a> (53)<br />
    
        <a href="/Category-10.html">Arcade</a> (110)<br />
    
        <a href="/Category-19.html">Bike</a> (40)<br />
    
        <a href="/Category-11.html">Board</a> (30)<br />

    
        <a href="/Category-4.html">Car</a> (106)<br />
    
        <a href="/Category-14.html">Card</a> (20)<br />
    
        <a href="/Category-17.html">Classic</a> (24)<br />
    
        <a href="/Category-3.html">Dress Up</a> (206)<br />

    
        <a href="/Category-15.html">Fighting</a> (51)<br />
    
        <a href="/Category-23.html">High Score</a> (305)<br />
    
        <a href="/Category-12.html">Multiplayer</a> (33)<br />
    
        <a href="/Category-22.html">Music</a> (18)<br />

    
        <a href="/Category-16.html">Plane</a> (38)<br />
    
        <a href="/Category-7.html">Platform</a> (96)<br />
    
        <a href="/Category-2.html">Puzzle</a> (212)<br />
    
        <a href="/Category-6.html">Racing</a> (57)<br />

    
        <a href="/Category-20.html">Role Playing</a> (39)<br />
    
        <a href="/Category-9.html">Shooting</a> (250)<br />
    
        <a href="/Category-21.html">Simulation</a> (55)<br />
    
        <a href="/Category-18.html">Skill</a> (238)<br />

    
        <a href="/Category-8.html">Sport</a> (94)<br />
    
        <a href="/Category-5.html">Strategy</a> (116)<br />
    
                        
                        

<h1 title="Today's Most Active Users">Top Gamers</h1>

        <table class="gamelist">
    
        <tr>

            <td>1.</td>
            <td>
                <a href="/User-1144.html"><img src="/Avatars/Shared/39.jpg" alt="Boogawoog's Avatar" border="0" style="width:3em; border-width:0px;" /></a>
            </td>
            <td><a href="/User-1144.html">Boogawoog</a></td>
        </tr>
    
        <tr class="altrow">
            <td>2.</td>

            <td>
                <a href="/User-457.html"><img src="/Avatars/Shared/634.jpg" alt="DamJam's Avatar" border="0" style="width:3em; border-width:0px;" /></a>
            </td>
            <td><a href="/User-457.html">DamJam</a></td>
        </tr>
    
        <tr>
            <td>3.</td>
            <td>

                <a href="/User-1260.html"><img src="/Avatars/Shared/92.jpg" alt="Throglamp's Avatar" border="0" style="width:3em; border-width:0px;" /></a>
            </td>
            <td><a href="/User-1260.html">Throglamp</a></td>
        </tr>
    
        <tr class="altrow">
            <td>4.</td>
            <td>
                <a href="/User-734.html"><img src="/Avatars/Shared/29.jpg" alt="ReDBuLL's Avatar" border="0" style="width:3em; border-width:0px;" /></a>

            </td>
            <td><a href="/User-734.html">ReDBuLL</a></td>
        </tr>
    
        <tr>
            <td>5.</td>
            <td>
                <a href="/User-127.html"><img src="/Avatars/Shared/60.jpg" alt="Rage's Avatar" border="0" style="width:3em; border-width:0px;" /></a>
            </td>

            <td><a href="/User-127.html">Rage</a></td>
        </tr>
    
        </table>
    

<div class="listFooter">
    ... <a id="ctl00__ctrl_1_MoreActiveUsers" href="/TopGamers.html">More</a> ...
</div>
                        
                        
                        
                        <br />

                        
                        <script type="text/javascript"><!--
                        google_ad_client = "pub-3225396957957589";
                        google_ad_slot = "5868037942";
                        google_ad_width = 160;
                        google_ad_height = 90;
                        //-->
                        </script>
                        <script type="text/javascript"
                        src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
                        </script>
                    </td>
</tr>
</table>

            
        </div>

        <br style="clear: both;" />

        

<div class="footer">
    © 2008 - 2009 Big Fun Town<br />
    <a id="ctl00_ctl10_UrlFreeGames" href="/FreeGames.html">Free Games for your Site</a> |
    <a id="ctl00_ctl10_UrlSubmitGame" href="/SubmitGame.html">Submit Game</a> |
    <a id="ctl00_ctl10_UrlContactUs" href="/Contact.html">Contact Us</a> | 
    <a id="ctl00_ctl10_UrlPrivacyPolicy" href="/Privacy.html">Privacy</a> | 
    <a id="ctl00_ctl10_UrlTermsOfUse" href="/Terms.html">Terms</a>

</div>
     
        <script src="/Scripts/BugFixes.js" type="text/javascript"></script>

    </form>
        
    <script type="text/javascript">
    var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
    document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
    </script>
    <script type="text/javascript">
    var pageTracker = _gat._getTracker("UA-4199705-3");
    pageTracker._initData();
    pageTracker._trackPageview();
    </script>
</body>
</html>

My plan is to enter the website link in a form field and have a button called Auto-fill. When the button is clicked, it gets the website from the form field, and extracts certain info and puts it into my form fields. The info I'm looking to extract is the category, description, name of the game, and the link to the flash file.

Link to comment
Share on other sites

I like scraping, so I wrote this for you:

 

<?php
$url = 'http://www.bigfuntown.com/Game-1497.html';
$html = file_get_contents($url);
//parentheses: 1. game title, 2. relative swf link, 3. categories incl. HTML, 4. game description
preg_match('~<title>([^<]*).+(/Games/[^.]+.swf).+Categories:\s*(.*?)<br />.+?GameDescription">([^<]*)~s', $html, $matches);
$game_title = trim($matches[1]);
$game_swf = 'http://www.bigfuntown.com' . $matches[2];
$game_desc = trim($matches[4]);
$game_cat = explode(',', strip_tags($matches[3]));
$game_cat = array_map('trim', $game_cat);
//note that $game_cat is an array of categories
?>

The rest should be the easy part, combining the code with a form. And remember the copyright laws; don't steal.

Link to comment
Share on other sites

Worked like a charm. Thank you. Is there any way to select one category instead of all of them? I'm using a drop-down list for the categories and in that sites games, there sometimes is a high score in the category like this, "Categories: High Score, Platform, Shooting, Spark High Scores". Or somehow check their categories vs. a list of mine.

Link to comment
Share on other sites

In my original script I created to add games, I would manually extract the data from websites. In this script, I have a drop-down list of categories. I was wondering if I could cross-reference the category extracted from the remote site against the list of categories in my list. Maybe using in_array? I'm not really sure how to go about it.

Link to comment
Share on other sites

But when a game has more than one category, then what? I take it you want to use the multiple attribute with the select element. This code will check the returned categories in $game_cat with an array of specified categories, and pre-select the matches in the list:

 

<?php
$game_cat = array('High Score', 'Platform', 'Shooting', 'Spark High Scores');
$categories = array('Shooting', 'Flying', 'RPG', 'Platform', 'Racing');
echo '<select multiple="multiple" name="cat">';
foreach ($categories as $category) {
if (in_array($category, $game_cat)) {
	echo "\n\t<option selected=\"selected\">$category</option>";
} else {
	echo "\n\t<option>$category</option>";
}
}
echo "\n</select>";
?>

Output:

 

<select multiple="multiple" name="cat">
<option selected="selected">Shooting</option>
<option>Flying</option>
<option>RPG</option>
<option selected="selected">Platform</option>
<option>Racing</option>
</select>

Link to comment
Share on other sites

Not at all:

$autofill_url = $_POST['autofill_url'];
if(isset($autofill_url) && $autofill_url >= 0 && is_numeric($autofill_url)) {
$autofill_site = 'http://www.bigfuntown.com/Game-'.$autofill_url.'.html';
$html = file_get_contents($autofill_site);
preg_match('~<title>([^<]*).+(/Games/[^.]+.swf).+Categories:\s*(.*?)<br />.+?GameDescription">([^<]*)~s', $html, $matches);
$game_title = trim($matches[1]);
$game_swf = 'http://www.bigfuntown.com' . $matches[2];
$game_desc = trim($matches[4]);
$game_cat = explode(',', strip_tags($matches[3]));
$game_cat = array_map('trim', $game_cat);
$categories = array('Action','Adventure','Arcade','Bike','Board','Car','Fighting','Multiplayer','Music','Plane','Platform','Puzzle','Other','Racing','Role Playing','Shooting','Simulation','Skill','Sport','Strategy');
foreach ($game_cat as $category) {
	if (in_array($category,$categories)) {
		echo "\n\t<option>$category</option>";
	}
}
}

Link to comment
Share on other sites

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.