Important alert: (current site time 7/15/2013 11:27:35 AM EDT)
 

VB icon

Planet Source Code Latest Code *UPDATE #3*

Email
Submitted on: 10/30/2000 11:05:48 AM
By: Max Demian  
Level: Advanced
User Rating: By 2 Users
Compatibility: PHP 3.0, PHP 4.0
Views: 18861
(About the author)
 
     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.
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.
				
//**************************************
// 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: Max Demian
//
//This code is copyrighted and has// limited warranties.Please see http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=224&lngWId=8//for details.//**************************************

<?
// Planet Source Code Latest Code *UPDATE #3*
// Writer: Max - Demian Net
// E-Mail: Max@Wackowoh.com
// WebSite: http://www.DemianNet.com http://www.Wackowoh.com
// Language: PHP
// Usage:
// include("psc.php?world=World+Number+or+Name");
// or
// require "psc.php?world=World+Number+or+Name";
// examples
// include("psc.php?world=1");
// require "psc.php?world=vb";
// Worlds:
// Visual Basic = 1 or vb
// Java/Javascript = 2 or java
// C/C++ = 3 or c
// ASP/VBScript = 4 or asp
// SQL= 5 or sql
// Perl = 6 or perl
// Delphi = 7 or delphi
// PHP= 8 or php
// PSC URLs:
// www.planet-source-code.com
// www.planetsourcecode.com
// www.pscode.com
// www.1aspstreet.com
// www.1activeserverpagesstreet.com
// www.1cstreet.com
// www.1cplusplusstreet.com
// www.1delphistreet.com
// www.1javastreet.com
// www.1javascriptstreet.com
// www.1perlstreet.com
// www.1phpstreet.com
// www.1sqlstreet.com
// www.1vbstreet.com
// www.1visualbasicstreet.com
// www.cpluspluscode.com
// Variables:
$url = "www.planet-source-code.com";
// None of this needs to be edited
function psccode($sec, $thesite) {
 $buffer = implode("", file("http://".$thesite."/vb/linktous/ScrollingCode.asp?lngWId=".$sec));
 preg_match_all("|(<a target[^>]+>)|U", $buffer, $psccodeurl, PREG_PATTERN_ORDER);
 preg_match_all("|([a-zA-z].*</a></b></font>)|U", $buffer, $psccodename, PREG_PATTERN_ORDER);
 $i = 0;
 echo "<base href=\"http://".$thesite."\">\n";
 for ($i = 0; $i < count($psccodeurl[1]);$i++){
 echo "{$psccodeurl[1][$i]}{$psccodename[1][$i]}<br>\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:<BR>\nhttp://".$HTTP_HOST.$PATH_INFO."?world=(World Number)";
 }
} else {
 psccode($world, $url);
}
?>


Other 12 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Advanced category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.