Author: dongy
Date: 2006-04-12 14:07:02 +0000 (Wed, 12 Apr 2006)
New Revision: 8528

Modified:
   trunk/apps/DarknetSpiderBot/DarknetSpiderBot.php
   trunk/apps/DarknetSpiderBot/fcp.php
Log:
DarknetSpiderBot: splitURL function added

Modified: trunk/apps/DarknetSpiderBot/DarknetSpiderBot.php
===================================================================
--- trunk/apps/DarknetSpiderBot/DarknetSpiderBot.php    2006-04-12 04:01:17 UTC 
(rev 8527)
+++ trunk/apps/DarknetSpiderBot/DarknetSpiderBot.php    2006-04-12 14:07:02 UTC 
(rev 8528)
@@ -103,25 +103,19 @@
                // strip freenet:
                if ( substr($url, 0, 9) == '/freenet:')
                        $url = '/'.substr($url, 9);
+

-               
                $splitedURL['key_type'] = substr($url, 1, 3);

                $second_slashe_pos = strpos($url, '/', 5);
                $splitedURL['key_value'] = substr($url, 5, 
$second_slashe_pos-5);

-               //if ( preg_match('#(.+)[/-]+([0-9]+)(.+)#', substr($url, 
$second_slashe_pos+1), $matches ) )
-               if ( preg_match('/^[a-zA-Z0-9]+-[0-9]+/[a-zA-Z0-9\.\/_-]+$/', 
substr($url, $second_slashe_pos+1), $matches ) )
-                       $splitedURL['site_name'] = $matches[1];
+               preg_match('#^(.+)[/-]+([0-9]+)/*(.*)$#', substr($url, 
$second_slashe_pos+1), $matches );
+               $splitedURL['site_name'] = $matches[1];
+               $splitedURL['edition'] = $matches[2];
+               $splitedURL['path'] = $matches[3];

-               echo 't:'.substr($url, $second_slashe_pos+1).'end';

-               print_r($matches);
-               
-               
-               //
-               
-                       
                return $splitedURL;
        }


Modified: trunk/apps/DarknetSpiderBot/fcp.php
===================================================================
--- trunk/apps/DarknetSpiderBot/fcp.php 2006-04-12 04:01:17 UTC (rev 8527)
+++ trunk/apps/DarknetSpiderBot/fcp.php 2006-04-12 14:07:02 UTC (rev 8528)
@@ -20,11 +20,21 @@
        $out .= "EndMessage\r\n";       

        fwrite($fp, $out);
-
-       while ( !feof($fp) )
+       
+       $i=1;
+       while ( !feof($fp) && $i<30)
        {  
                $buffer = fgets($fp);
+               $buffer_1 .= $buffer;
+               
+               if ($buffer === false)
+                       break;
+                       
+               $i++;
+
                //echo $buffer;
+               
+               /*
                if (preg_match_all('/NodeHello/si', $buffer, $match)) { 
                        echo "ok connection\n";
                        break; 
@@ -33,10 +43,13 @@
                        echo "non ok connection\n";
                        break; 
                }
+               */
        }

+       echo "\n\nb1\n$buffer_1\n\n";

-
+       
+       /*
        $out = "ClientGet\r\n";
        $out .= "URI=$addresse\r\n";
        $out .= "Identifier=Request Number One\r\n";
@@ -73,14 +86,22 @@
                        }
                }

-               if (preg_match_all('/<html>/si', $buffer, $match)) { 
+               
+               if (preg_match_all('/<\/html>/si', $buffer, $match)) { 
                        //echo "ok";
                        break; 
                }
-
+               
+               /*
+               if (!$buffer)
+                       break;
+               */ /*
+               $buffer_total .= $buffer;
        }

        fclose($fp);
-
+       
+       echo $buffer;
+*/
 }
 ?>
\ No newline at end of file


Reply via email to