Make your own free website on Tripod.com
//************************************** // Name: Planet Source Code Latest Code *UPDATE #3* // Description:Get the latest code from www.pscode.com (Planet Source Code), from any world. Makes use of looping & regular expressions (the hard part), since psc's latest code ticker had the code on 2 lines & had to use 2 regular expressions & 2 loops for each code, not easy. But bettter than most codes you see that will just grab the whole ticker code, mine parses & just takes the links. *UPDATE*, I changed it form lngWID=# to world=# (just seems easier), & now you dont just have to put the number in, you can put like: world=vb or world=c . *UPDATE #2*, Does the EXACT same thing as the first update but I changed it so it doesnt have the code to get & parse the source 9 times, I made it into a funtion (psccode) so it can just do psccode(number); example: psccode(1); would be for vb. Cuts the code down ALOT, bout 1/3 the size now. *UPDATE #3* lets you choose what PSC URL you want to use (only changed function and how it is used). hopefully ill get it working where you can choose how many urls you want to get & have 0 get them all done soon. // By: Demian Net // // // Inputs:None // // Returns:None // //Assumes:None // //Side Effects:None //This code is copyrighted and has limited warranties. //Please see http://www.Planet-Source-Code.com/xq/ASP/txtCodeId.224/lngWId.8/qx/vb/scripts/ShowCode.htm //for details. //************************************** ]+>)|U", $buffer, $psccodeurl, PREG_PATTERN_ORDER); preg_match_all("|([a-zA-z].*)|U", $buffer, $psccodename, PREG_PATTERN_ORDER); $i = 0; echo "\n"; for ($i = 0; $i < count($psccodeurl[1]);$i++){ echo "{$psccodeurl[1][$i]}{$psccodename[1][$i]}
\n"; } } if ((1 > $world) or ($world > 8)) { if ($world == "vb") { psccode(1, $url); } elseif ($world == "java") { psccode(2, $url); } elseif ($world == "c") { psccode(3, $url); } elseif ($world == "asp") { psccode(4, $url); } elseif ($world == "sql") { psccode(5, $url); } elseif ($world == "perl") { psccode(6, $url); } elseif ($world == "delphi") { psccode(7, $url); } elseif ($world == "php") { psccode(8, $url); } else { echo "No World or Invalid World Entered. Format:
\nhttp://".$HTTP_HOST.$PATH_INFO."?world=(World Number)"; } } else { psccode($world, $url); } ?>