theani Posted February 16, 2007 Share Posted February 16, 2007 I want to have a page like http://mathprob.com/code/contestinput.php which lets the user input the html source code of a contest resource page from http://www.artofproblemsolving.com/Forum/resources.php. However, what the program does is that it takes the source code, and gets rid of all the html code: <link rel="stylesheet" href="./templates/ptifo/mathlinks.css" type="text/css"> <!--[if IE 6]> <link rel="stylesheet" href="./templates/mlie6mods.css" type="text/css"> <![endif]--> <!--[if IE 7]> <link rel="stylesheet" href="./templates/mlie7mods.css" type="text/css"> <![endif]--> <style type="text/css"> .bgTop { background-image: url('./images/bg_top.gif'); background-repeat: repeat-x} .bgBottom { background-color: #E8EEF2; background-image: url('./images/bg_bottom.gif'); background-repeat: repeat-x} .bgMiddle { background-image: url('./images/bgMiddle.gif'); background-repeat: repeat-x} </style> <script language="JavaScript" type="text/javascript" src="./templates/overall.js"></script> <script language="JavaScript" type="text/javascript" src="./includes/js_dom_toggle.js"></script> <script language="Javascript" type="text/javascript"> <!-- if ( 0 ) { window.open('privmsg.php?mode=newpm', '_phpbbprivmsg', 'HEIGHT=225,resizable=yes,WIDTH=400');; } //--> </script> </head> <body> <a name="top"></a> <!-- table 1 --> <table width="100%" border="0" cellspacing="0" cellpadding="2"> <tr> <td class="bodyline" bgcolor="#FFFFFF"> <!-- table 1.1 --> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="189"> <a href="portal.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('portal','','./images/index-over.gif',1)"> <img name="portal" src="./images/index.gif" width="189" height="105" alt="" border="0" /></a> </td> <td valign="top" width="100%" class="bgTop"> <!-- table 1.1.1 --> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr align="right" valign="middle"> <td height="43" colspan="7"> <div style="border: 0px; padding: 0px; text-align: right; float: right;"> <a href="http://www.artofproblemsolving.com" class = "mainmenu" target="_blank"> Art of Problem Solving</a> <span class="mainmenu"> | </span> <a href="./index.php?f=17" class = "mainmenu"> News</a> <span class="mainmenu"> | </span> <a href="galleries.php" class = "mainmenu"> Galleries</a> <span class="mainmenu"> | </span> <a href="apsjour.php" class="mainmenu" > Blogs</a> <span class="mainmenu"> | </span> <a href="./about.php" class="mainmenu"> About</a> <span class="mainmenu"> | </span> <a href="http://www.mathlinks.ro/Forum/portal.php" class="mainmenu"> Home</a> </div> </td> </tr> <tr valign="bottom"> <td width="14%" height="50" class="bgMiddle" align="center"> <a href="index.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('forum','','./images/forum_on.gif',1)"> <img name="forum" border="0" src="./images/forum.gif" width="69" height="50" alt="MathLinks Forum" /></a> </td> <td width="14%" height="50" class="bgMiddle" align="center"> <a href="../LaTeX/AoPS_L_About.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('latex','','./images/latex_on.gif',1)" target="_blank"> <img name="latex" border="0" src="./images/latex.gif" width="69" height="50" alt="LaTeX Help" /></a> </td> <td width="14%" height="50" class="bgMiddle" align="center"> <a href="../Classes/AoPS_C_About.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('classes','','./images/classes_on.gif',1)" target="_blank"> <img name="classes" border="0" src="./images/classes.gif" width="69" height="50" alt="AoPS Classes" /></a> </td> <td width="14%" height="50" class="bgMiddle" align="center"> <a href="../Books/AoPS_B_About.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('books','','./images/books_on.gif',1)" target="_blank"> <img name="books" border="0" src="./images/books.gif" width="69" height="50" alt="Books" /></a> </td> <td width="14%" height="50" class="bgMiddle" align="center"> <a href="../Classroom/AoPS_Classroom.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('classroom','','./images/classroom_on.gif',1)" target="_blank"> <img name="classroom" border="0" src="./images/classroom.gif" width="69" height="50" alt="Classroom" /></a> </td> <td width="14%" height="50" class="bgMiddle" align="center"> <a href="contest.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('features','','./images/contest-over.gif',1)"> <img name="features" border="0" src="./images/contest.gif" width="69" height="50" alt="MathLinks Contest" /></a> </td> <td width="14%" height="50" class="bgMiddle" align="center"> <a href="resources.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('downloads','','./images/resources_on.gif',1)"> <img name="downloads" border="0" src="./images/resources.gif" width="69" height="50" alt="Math Resources" /></a> </td> </tr> </table> <!-- table 1.1.1 --> </td> </tr> </table> <!-- table 1.1 --><!-- table 1.2 --> <table width="100%" border="0" cellspacing="0" cellpadding="10"> <tr> <td colspan="2"> <!-- table 1.2.1 --> <div style="border: 0px; float: left; text-align: left;"> <div style="padding: 2px;"> <span class="mainmenu"> <a href="./index.php?f=217" class="mainmenu"> <img src="./templates/ptifo/images_mathlinks/common/ft_folder.gif" width="12" height="13" border="0" align="top" alt="See only the Advanced Section" hspace="3" />Advanced Section</a> <a href="./index.php?f=218" class="mainmenu"> <img src="./templates/ptifo/images_mathlinks/common/ft_folder.gif" width="12" height="13" border="0" align="top" alt="College Playground" hspace="3" />College Playground</a> </span> </div> <div style="padding: 2px;"> <span class="mainmenu"> <a href="index.php?f=87" class="mainmenu"> <img src="./templates/ptifo/images_mathlinks/common/ft_folder.gif" width="12" height="13" border="0" align="top" alt="International Mathematical Olympiad" hspace="3" />International Mathematical Olympiad</a> <a href="./index.php?f=248" class="mainmenu"> <img src="./templates/ptifo/images_mathlinks/common/ft_folder.gif" width="12" height="13" border="0" align="top" alt="National and Local Communities" hspace="3" />National Forums</a> </span> </div> </div> <!-- table 1.2.1 --><!-- table 1.2.2 --> <div style="border: 0px; float: right; text-align: right;"> <div style="padding: 2px;"> <span class="mainmenu"> <a href="galleries.php?f=435&u=9401" title="Personal gallery" class="mainmenu"><img src="./templates/ptifo/images/common/fs_menu_personal_gallery.gif" border="0" alt="" hspace="3" />Personal gallery</a> <a href="galleries.php" title="Galleries" class="mainmenu"><img src="./templates/ptifo/images/common/fs_menu_albums.gif" border="0" alt="Galleries" hspace="3" />Galleries</a> <a href="weblog.php?w=710" class="mainmenu"><img src="./templates/ptifo/images_mathlinks/common/ft_folder.gif" border="0" alt="My blog" hspace="3" />My blog</a> <a href="faq.php" class="mainmenu"><img src="./templates/ptifo/images_mathlinks/common/fs_menu_faq.gif" border="0" alt="FAQ" hspace="3" />FAQ</a> <a href="search.php" class="mainmenu"><img src="./templates/ptifo/images_mathlinks/common/fs_menu_search.gif" border="0" alt="Search" hspace="3" />Search</a> <a href="memberlist.php" class="mainmenu"><img src="./templates/ptifo/images_mathlinks/common/fs_menu_memberlist.gif" border="0" alt="Memberlist" hspace="3" />Memberlist</a> <a href="groupcp.php" class="mainmenu"><img src="./templates/ptifo/images_mathlinks/common/fs_menu_usergroup.gif" border="0" alt="Usergroups" hspace="3" />Usergroups</a> </span> </div> <div style="padding: 2px;"> <span class="mainmenu"> <a href="usercp.php?mode=subs&sub=favs" class="mainmenu"><img src="./templates/ptifo/images/common/ft_favorites.gif" alt="Favorites" hspace="3" border="0" />Favorites</a> <a href="usercp.php" class="mainmenu"><img src="./templates/ptifo/images_mathlinks/common/fs_menu_profile.gif" border="0" alt="Profile" hspace="3" />Profile</a> <a href="privmsg.php?folder=inbox" class="mainmenu"><img src="templates/ptifo/images_mathlinks/common/fs_menu_msg_pm.gif" border="0" alt="You have no new messages" hspace="3" />You have no new messages</a> <a href="login.php?logout=true&sid=d69b040eba62cafd65e702446a650789" class="mainmenu"><img src="./templates/ptifo/images_mathlinks/common/fs_menu_logout.gif" border="0" alt="Log out [ #H34N1 ]" hspace="3" />Log out [ #H34N1 ]</a> </span> </div> </div> <!-- table 1.2.2 --> </td> </tr> </table> <br class="nav" /> <table width="100%" cellspacing="0" cellpadding="2" border="0" align="center"> <tr> <td align="left" valign="bottom"><span class="gensmall"> You last visited on Today, at 2:02 pm<br /> The time now is Fri Feb 16, 2007 5:05 pm<br /> All times are UTC - 5 (DST in action)</span></td> <td align="right" valign="bottom" class="gensmall"> <a href="search.php?search_id=newposts" class="gensmall">View posts since last visit</a><br /> <a href="search.php?search_id=unanswered" class="gensmall">View unanswered posts</a><br /> <a href="search.php?search_id=egosearch" class="gensmall">View your posts</a><br /></td> </tr> </table> <div class="bodyline navigation_box row1"> <div class="breadcrumbs"><a href="index.php" title="the Art of Problem Solving Math Forums" class="nav">Forum index</a> » <a href="resources.php" title="" class="nav">Olympiad Resources</a> » <a href="resources.php?c=182" title="" class="nav">USA</a> » <a href="resources.php?c=182&cid=44" title="" class="nav">AMC 12</a> » <a href="resources.php?c=182&cid=44&year=2007" title="" class="nav">2007</a></div> <div class="clear"> </div> </div> <script type="text/javascript"> <!-- var message=""; function clickIE() {if (document.all) {(message);return false;}} function clickNS(e) {if (document.layers||(document.getElementById&&!document.all)) { if (e.which==2||e.which==3) {(message);return false;}}} if (document.layers) {document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;} else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;} document.oncontextmenu=new Function("return false")//--> </script> <table class="forumline" cellspacing="1" style="width:100%; border:0;" > <tr> <th class="cathead" style="vertical-align:middle; height:25px;"> <b> USA AMC 12 2007</b> </th> </tr> <tr class="res_gen"> <td class="row1"> <div style="vertical-align:top; padding: 10px; text-align:center;" class="res_gen"> <a href="" class="nav"> Download PDF Version</a> </div> </td> </tr> I tried to do it with the php_replace() function but it doesn't work (as you can see). Can someone please help? Thanks. Quote Link to comment Share on other sites More sharing options...
Clinger Posted February 16, 2007 Share Posted February 16, 2007 Not entirely sure what you are trying to say / do. But htmlspecialchars will convert all your html characters such as < to <, etc. That will allow yout to display the code.. Quote Link to comment Share on other sites More sharing options...
theani Posted February 18, 2007 Author Share Posted February 18, 2007 This topic is ont solved! I want to get rid of everything in the thml file as shown. How do I do it? I do not want to convert HTMl characters. Quote Link to comment Share on other sites More sharing options...
theani Posted February 19, 2007 Author Share Posted February 19, 2007 Hi there! This is not solved!!! Quote Link to comment Share on other sites More sharing options...
marcus Posted February 19, 2007 Share Posted February 19, 2007 Explain in further detail what you're trying to do. Quote Link to comment Share on other sites More sharing options...
printf Posted February 19, 2007 Share Posted February 19, 2007 <?php $str = '<b>Hi</b>'; $str = strip_tags ( $str ); echo $str; ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.