1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[Php] Auto Pinger Code

Discussion in 'Black Hat SEO' started by meannn, May 21, 2011.

  1. meannn

    meannn Supreme Member

    Joined:
    Apr 22, 2009
    Messages:
    1,461
    Likes Received:
    1,896
    Occupation:
    Unemployed Winner
    Location:
    TR
    This is a script that pings your url to ping sites from a file.

    When you manually/auto post something to your site, add this code
    and this script will automatically pings your post. This function is already on wordpress, however, this is for those who don't use Wordpress.

    PHP:
    <?php  

    //********************************************************
      
    $blogTitle="Page title";    
    $blogUrl="http://www.yoursite.com/page";    
    $pingListFile="pinglist.txt";    
    $showDebugInfo=FALSE;     
    $replacementCount=0;     
    $userAgent="pingrpc.php by meannn";  

    //********************************************************

       
    $fp=fopen($pingListFile,"r");
       while ( ! 
    feof$fp) )
       {
          
    $line trim(fgets$fp4096));
          
    // get the hostname
          
    $host=$line// Make a copy of $line
          
    $host=preg_replace('/^.*http:\/\//','',$host); // Delete anything before http://
          
    $host=preg_replace('/\/.*$/','',$host); // Delete anything after behind the hostname

          // get the path 
          
    $path=$line// Make another copy of $line
          
    $path=preg_replace('/^.*http:\/\/[a-zA-Z0-9\-_\.]*\.[a-zA-Z]{1,3}\//','',$path,-1,$replacementCount); // Delete anything before the path
          
    if(!$replacementCount$path=''// if there was no replacement (i.e. no explicit path), act appropiately
          
    if($host$myList[$host]=$path;
       }


       
    $xml= new DOMDocument('1.0');
       
    $xml->formatOutput=true;
       
    $xml->preserveWhiteSpace=false;
       
    $xml->substituteEntities=false;

       
    // Create the xml structure
       
    $methodCall=$xml->appendChild($xml->createElement('methodCall'));
       
    $methodName=$methodCall->appendChild($xml->createElement('methodName'));
       
    $params=$methodCall->appendChild($xml->createElement('params'));
       
    $param[1]=$params->appendChild($xml->createElement('param'));
       
    $value[1]=$param[1]->appendChild($xml->createElement('value'));
       
    $param[2]=$params->appendChild($xml->createElement('param'));
       
    $value[2]=$param[2]->appendChild($xml->createElement('value'));

       
    // Set the node values
       
    $methodName->nodeValue="weblogUpdates.ping";
       
    $value[1]->nodeValue=$blogTitle;
       
    $value[2]->nodeValue=$blogUrl;

       
    $xmlrpcReq $xml->saveXML(); // Write the document into a string
       
    $xmlrpcLength strlen$xmlrpcReq ); // Get the string length.


       
    foreach ( $myList as $host => $path)
       {
          if(
    $showDebugInfo) echo "";

          echo 
    "";

          if(
    $showDebugInfo)
          {
    echo 
    "";
          }

          
    // Actually, send ping
          
    if ( $pinghandle = @fsockopen$host80 ) )
          {
         @
    fputs$pinghandle$httpReq );
         while ( ! 
    feof$pinghandle ) )
         { 
            
    $pingresponse = @fgets$pinghandle128 );
            if(
    $showDebugInfo) echo "";
         }
         @
    fclose$pinghandle );
          }
          if(
    $showDebugInfo) echo "";
       }
    ?>

    pingslist.txt

    Code:
    http://pastie.org/1948534
    
     
    • Thanks Thanks x 2
    Last edited: May 21, 2011
  2. TheRealRazzy

    TheRealRazzy Jr. VIP Jr. VIP

    Joined:
    Mar 2, 2011
    Messages:
    1,464
    Likes Received:
    1,761
    Location:
    Chicago, IL
    Home Page:
    Awesome Share!

    I was going to do something like this but I see you've beat me to it lol.

    Thanks :)
     
  3. game.ruler

    game.ruler Newbie

    Joined:
    Apr 3, 2011
    Messages:
    8
    Likes Received:
    1
    Can i use it on SMF?
     
  4. meannn

    meannn Supreme Member

    Joined:
    Apr 22, 2009
    Messages:
    1,461
    Likes Received:
    1,896
    Occupation:
    Unemployed Winner
    Location:
    TR
    You can use it anywhere that accepts php.
     
  5. joaquin112

    joaquin112 Regular Member

    Joined:
    Apr 4, 2010
    Messages:
    285
    Likes Received:
    220
    Location:
    Queretaro!
    Sorry for resurrecting this thread, but you have an error in your code. It should read: