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

Free PHP script. Autopost to WP-Article Directory

Discussion in 'Blogging' started by wickedguy, Feb 7, 2011.

  1. wickedguy

    wickedguy Supreme Member

    Joined:
    Jul 22, 2009
    Messages:
    1,402
    Likes Received:
    1,379
    Location:
    BHW--> South Africa
    Home Page:
    Ok Guys

    Here is a free PHP script for you to post to wordpress article directories. You can edit it to your liking :D

    Search for this footprint and you will find sites hosting the article directory add-on for wordpress.

    PHP:
    <?
    //USAGE

    //FOR CATEGORY YOU SHOULD USE UP TO 3 DIFFERENT CATEGORIES LIKE BELOW

    // animals:pets:dog   OR  business:marketing:affiliate marketing   <----- I THINK YOU GET THE IDEA
    //first the poster will look for dogs and if not found then pets and if pets not found then animals. If not one of these are found at a site, nothing will be posted to that site.

    post_article_wordpress($site,$email,$password,'animals:pets:dog');

    function 
    post_article_wordpress($site,$email,$password,$category){


    $ch curl_init();
    curl_setopt($chCURLOPT_URLtrim($site));
    curl_setopt($chCURLOPT_HEADERtrue);
    curl_setopt($chCURLOPT_NOBODYtrue);
    curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
    curl_setopt($chCURLOPT_FOLLOWLOCATIONtrue);
    curl_setopt($chCURLOPT_MAXREDIRS1); //follow up to 10 redirections - avoids loops
    curl_setopt($chCURLOPT_CONNECTTIMEOUT5);
    curl_setopt($chCURLOPT_TIMEOUT5);
    $data curl_exec($ch);
    curl_close($ch);
    flush();

    preg_match_all("/HTTP\/1\.[1|0]\s(\d{3})/",$data,$matches);
    $code end($matches[1]);
    if(!
    $data) {
      echo 
    $site." <b>No Response!!</b> Please try again Later.<br>";return;
    } else {
      if(
    $code==200) {
       
    // echo $site." <b>Found!!</b><br>";
      
    } elseif($code==404) {
       echo 
    $site." <b>Page Not Found!!</b><br>";return;
      }



    $email trim($email);
    $dir_user trim($penname);
    $dir_password trim($password);
    $article_category trim($category);

    //#################################################################3
    //HERE YOU MUST ADD THE DATA OF THE ARTICLE YOU WANT TO POST
    $article_title addslashes($article_title);//<----title here
    $article_summary stripslashes($article_summary);//<----summary here
    $article_summary addslashes($article_summary);
    $article_body addslashes($article_body);//<------articlebody here
    $resource_box stripslashes($resource_box);//<---resource box with your links
    $keywords trim($keywords);//<----your keywords
    $keywords stripslashes($keywords);

    //#################################################################





    $dir_name trim($site);
    $dir=trim($dir_name)."/wp-login.php";

    $ch curl_init();
    curl_setopt ($chCURLOPT_URL,$dir);
    curl_setopt ($chCURLOPT_POST1);
    $postString1="log=".$dir_user."&pwd=".$dir_password."&rememberme=forever&wp-submit=Log In&redirect_to=".$dir_name."/wp-admin/&testcookie=1";
    curl_setopt ($chCURLOPT_POSTFIELDS$postString1);
    curl_setopt ($chCURLOPT_COOKIEJAR'cookie.txt');
    curl_setopt ($chCURLOPT_RETURNTRANSFER1);
    curl_setopt($chCURLOPT_CONNECTTIMEOUT5);
    curl_setopt($chCURLOPT_TIMEOUT5);
    curl_setopt($chCURLOPT_FOLLOWLOCATIONtrue);
    curl_setopt($chCURLOPT_MAXREDIRS10); //follow up to 10 redirections - avoids loops
    $data curl_exec ($ch);
    //echo $data;exit;
    flush();

    if(
    stristr($data,"Incorrect password")){
    curl_close($ch);
    echo 
    "<b><FONT style=\"font-size:13px\" color=\"#FF0000\" face=\"Arial\">Sorry, Incorrect password at </font></b>".$dir_name."<br>";return;}
    if(
    stristr($data,"Invalid username")){
    curl_close($ch);
    echo 
    "<b><FONT style=\"font-size:13px\" color=\"#FF0000\" face=\"Arial\">Sorry, Invalid username at </font></b>".$dir_name."<br>";return;}
    if(
    stristr($data,"Incorrect username or password")){
    curl_close($ch);
    echo 
    "<b><FONT style=\"font-size:13px\" color=\"#FF0000\" face=\"Arial\">Sorry, Incorrect username or password at </font></b>".$dir_name."<br>";return;}
    if(
    stristr($data,"This Account Has Been")){
    curl_close($ch);
    echo 
    "<b><FONT style=\"font-size:13px\" color=\"#FF0000\" face=\"Arial\">Sorry, Account Suspended </font></b>".$dir_name."<br>";return;}

    //##########################################
    curl_setopt ($chCURLOPT_URLtrim($dir_name)."/wp-admin/edit.php"); 
    curl_setopt ($chCURLOPT_POST1);
    curl_setopt($chCURLOPT_CONNECTTIMEOUT5);                               //<<<--------------TO CHECK IF ARTICLE EXISTS.
    curl_setopt($chCURLOPT_TIMEOUT5);
    $data curl_exec ($ch);                
    flush();

    if(
    stristr($data,"not have sufficient permissions")){
    curl_close($ch);
    echo 
    "<b><FONT style=\"font-size:13px\" color=\"#FF0000\" face=\"Arial\">Sorry, You do not have sufficient permissions at </font></b>".$dir_name."<br>";return;}



    $articletitle $article_title;


    if(
    stristr($data,$articletitle)){
    curl_close($ch);
    echo 
    "<b><FONT style=\"font-size:13px\" color=\"#808080\" face=\"Arial\">".$articletitle." already exist at</font></b><FONT style=\"font-size:13px\" color=\"#0000FF\" face=\"Arial\"><i> ".$dir_name." </i></font><br>";return;}
    //#######################################

    curl_setopt ($chCURLOPT_URL,$dir_name."/wp-admin/post-new.php");
    curl_setopt ($chCURLOPT_RETURNTRANSFER1);
    curl_setopt($chCURLOPT_CONNECTTIMEOUT5);
    curl_setopt($chCURLOPT_TIMEOUT5);
    $data curl_exec ($ch);
    flush();

    $pattern '/<input type=\"hidden\" id=\"_wpnonce\" name=\"_wpnonce\" value=\"(.*?)\" \/>/si';
    preg_match($pattern,$data,$match);$_wpnonce $match[1];
    $pattern '/<input type=\"hidden\" name=\"_wp_http_referer\" value=\"(.*?)\" \/>/si';
    preg_match($pattern,$data,$match);$_wp_http_referer $match[1];
    $pattern '/<input type=\"hidden\" id=\"user-id\" name=\"user_ID\" value=\"(.*?)\" \/>/si';
    preg_match($pattern,$data,$match);$user_ID $match[1];
    $pattern '/<input type=\"hidden\" id=\"hiddenaction\" name=\"action\" value=\"(.*?)\" \/>/si';
    preg_match($pattern,$data,$match);$action $match[1];
    $pattern '/<input type=\"hidden\" id=\"originalaction\" name=\"originalaction\" value=\"(.*?)\" \/>/si';
    preg_match($pattern,$data,$match);$originalaction $match[1];
    $pattern '/<input type=\"hidden\" id=\"post_author\" name=\"post_author\" value=\"(.*?)\" \/>/si';
    preg_match($pattern,$data,$match);$post_author $match[1];
    $pattern '/<input type=\"hidden\" id=\"post_type\" name=\"post_type\" value=\"(.*?)\" \/>/si';
    preg_match($pattern,$data,$match);$post_type $match[1];
    $pattern '/<input type=\"hidden\" id=\"original_post_status\" name=\"original_post_status\" value=\"(.*?)\" \/>/si';
    preg_match($pattern,$data,$match);$original_post_status $match[1];
    $pattern '/<input type=\"hidden\" id=\"referredby\" name=\"referredby\" value=\"(.*?)\" \/>/si';
    preg_match($pattern,$data,$match);$referredby $match[1];
    $pattern '/<input type=\"hidden\" name=\"_wp_original_http_referer\" value=\"(.*?)\" \/>/si';
    preg_match($pattern,$data,$match);$_wp_original_http_referer $match[1];
    $pattern '/<input type=\'hidden\' id=\'auto_draft\' name=\'auto_draft\' value=\'(.*?)\' \/>/si';
    preg_match($pattern,$data,$match);$auto_draft $match[1];
    $pattern '/<input type=\'hidden\' id=\'post_ID\' name=\'post_ID\' value=\'1584\' \/>/si';
    preg_match($pattern,$data,$match);$post_ID $match[1];
    $pattern '/<input type=\"hidden\" id=\"autosavenonce\" name=\"autosavenonce\" value=\"(.*?)\" \/>/si';
    preg_match($pattern,$data,$match);$autosavenonce $match[1];
    $pattern '/<input type=\"hidden\" id=\"meta-box-order-nonce\" name=\"meta-box-order-nonce\" value=\"(.*?)\" \/>/si';
    preg_match($pattern,$data,$match);$metaboxordernonce $match[1];
    $pattern '/<input type=\"hidden\" id=\"closedpostboxesnonce\" name=\"closedpostboxesnonce\" value=\"(.*?)\" \/>/si';
    preg_match($pattern,$data,$match);$closedpostboxesnonce $match[1];
    $pattern '/<input type=\"hidden\" id=\"hidden_mm\" name=\"hidden_mm\" value=\"(.*?)\" \/>/si';
    preg_match($pattern,$data,$match);$hidden_mm $match[1];
    $pattern '/<input type=\"hidden\" id=\"cur_mm\" name=\"cur_mm\" value=\"(.*?)\" \/>/si';
    preg_match($pattern,$data,$match);$cur_mm $match[1];
    $pattern '/<input type=\"hidden\" id=\"hidden_jj\" name=\"hidden_jj\" value=\"(.*?)\" \/>/si';
    preg_match($pattern,$data,$match);$hidden_jj $match[1];
    $pattern '/<input type=\"hidden\" id=\"cur_jj\" name=\"cur_jj\" value=\"(.*?)\" \/>/si';
    preg_match($pattern,$data,$match);$cur_jj $match[1];
    $pattern '/<input type=\"hidden\" id=\"hidden_aa\" name=\"hidden_aa\" value=\"(.*?)\" \/>/si';
    preg_match($pattern,$data,$match);$hidden_aa $match[1];
    $pattern '/<input type=\"hidden\" id=\"cur_aa\" name=\"cur_aa\" value=\"(.*?)\" \/>/si';
    preg_match($pattern,$data,$match);$cur_aa $match[1];
    $pattern '/<input type=\"hidden\" id=\"hidden_hh\" name=\"hidden_hh\" value=\"(.*?)\" \/>/si';
    preg_match($pattern,$data,$match);$hidden_hh $match[1];
    $pattern '/<input type=\"hidden\" id=\"cur_hh\" name=\"cur_hh\" value=\"(.*?)\" \/>/si';
    preg_match($pattern,$data,$match);$cur_hh $match[1];
    $pattern '/<input type=\"hidden\" id=\"hidden_mn\" name=\"hidden_mn\" value=\"(.*?)\" \/>/si';
    preg_match($pattern,$data,$match);$hidden_mn $match[1];
    $pattern '/<input type=\"hidden\" id=\"cur_mn\" name=\"cur_mn\" value=\"(.*?)\" \/>/si';
    preg_match($pattern,$data,$match);$cur_mn $match[1];//exit;

    $all_above="_wpnonce=$_wpnonce&_wp_http_referer=$_wp_http_referer&user-id=$user_ID&action=$action&originalaction=$originalaction&post_author=$post_author&post_type=$post_type&original_post_status=$original_post_status&referredby=$referredby&temp_ID=$post_ID&autosavenonce=$autosavenonce&meta-box-order-nonce=$metaboxordernonce&closedpostboxesnonce=$closedpostboxesnonce&hidden_mm=$hidden_mm&cur_mm=$cur_mm&hidden_jj=$hidden_jj&cur_jj=$cur_jj&hidden_aa=$hidden_aa&cur_aa=$cur_aa&hidden_hh=$hidden_hh&cur_hh=$cur_hh&hidden_mn=$hidden_mn&cur_mn=$cur_mn";


    $id_name get_cat_artwordpress($data,$article_category);
    if(
    trim($id_name)==""){echo "<FONT style=\"font-size:13px\" color=\"#FF0000\" face=\"Arial\">Sorry, but NO Suitable Category found at </font>".$dir_name."<br>";return;}
    $id_name explode("||",$id_name);
    $categoryid trim($id_name[0]);
    $categoryname trim($id_name[1]);
    $categoryname str_replace(" ","",$categoryname);
    $categoryname str_replace(">","",$categoryname);

    $categoryname str_replace("-","",$categoryname);
    $categoryname trim($categoryname);




    //echo $categoryid." - ".$categoryname." - ".$dir_name."<br>";exit;


    $postString$all_above."&email=".$email."&post_category=".$categoryid."&post_title=".rawurlencode(html_entity_decode($article_title))."&content=" rawurlencode(html_entity_decode($article_body."<br><br>")) . rawurlencode(html_entity_decode($resource_box)) ."&tax_input[post_tag]="rawurlencode(html_entity_decode($keywords))."&publish=Publish&accesskey=p";    


    curl_setopt ($chCURLOPT_URLtrim($dir_name)."/wp-admin/post.php"); 
    curl_setopt ($chCURLOPT_POST1);
    curl_setopt ($chCURLOPT_POSTFIELDS$postString);
    //curl_setopt ($ch, CURLOPT_POSTFIELDS, '');
    curl_setopt ($chCURLOPT_RETURNTRANSFER1);
    curl_setopt($chCURLOPT_CONNECTTIMEOUT5);
    curl_setopt($chCURLOPT_TIMEOUT5);
    curl_setopt($chCURLOPT_FOLLOWLOCATIONtrue);
    curl_setopt($chCURLOPT_MAXREDIRS10); //follow up to 10 redirections - avoids loops
    $data curl_exec ($ch);
    flush();
    //echo $data;exit;

    if(stristr($data,$article_title)){
    curl_close($ch);
    echo 
    "<FONT style=\"font-size:13px\" color=\"#0000FF\" face=\"Arial\">Submission to ".$dir_name." under Category: <b>".$categoryname." </b>was successfull!!</font><br>";$successfull++;return;}

            
    if(
    stristr($data,"Article Friendly Article Publishing Script")){
    echo 
    "<FONT style=\"font-size:13px\" color=\"#0000FF\" face=\"Arial\">Submission to ".$dir_name." under Category: <b>".$categoryname." </b>was successfull!!</font><br>";$successfull++;
    }else{
    echo 
    "<b><FONT style=\"font-size:13px\" color=\"#FF0000\" face=\"Arial\">Sorry, an unknown ERROR occured at </font></b>".$dir_name."<br>";
    }
    curl_close ($ch);


    function 
    get_cat_artwordpress($content,$cat){
    $answer ='';

    if(
    stristr($cat,":")){
    $cat1 explode(":",$cat);
    $count=count($cat1)-1;
    $catt trim($cat1[$count]);
    $catt2 trim($cat1[1]);
    $catt3 trim($cat1[0]);

    //#########################################
    preg_match_all('/<input value=\"(.*?)\" type=\"checkbox\" name=\"post_category\[\]\" id=\"(.*?)\"\/>(.*?)<\/label/si'$content$matches);

    for (
    $i=0$icount($matches[0]); $i++) {
    if(
    stristr($matches[3][$i],$catt)){
    $answer trim($matches[1][$i])."||".trim($matches[3][$i]);
    return 
    $answer;
    }
    }
    //end for

    for ($i=0$icount($matches[0]); $i++) {
    if(
    stristr($matches[3][$i],$catt2)){
    $answer trim($matches[1][$i])."||".trim($matches[3][$i]);
    return 
    $answer;
    }
    }
    //end for

    for ($i=0$icount($matches[0]); $i++) {
    if(
    stristr($matches[3][$i],$catt3)){
    $answer trim($matches[1][$i])."||".trim($matches[3][$i]);
    return 
    $answer;
    }
    }
    //end for

    for ($i=0$icount($matches[0]); $i++) {
    if(
    stristr($matches[3][$i],"uncategorized")){
    $answer trim($matches[1][$i])."||".trim($matches[3][$i]);
    return 
    $answer;
    }
    }
    //end for

    for ($i=0$icount($matches[0]); $i++) {
    if(
    stristr($matches[3][$i],"misc")){
    $answer trim($matches[1][$i])."||".trim($matches[3][$i]);
    return 
    $answer;
    }
    }
    //end for

    for ($i=0$icount($matches[0]); $i++) {
    if(
    stristr($matches[3][$i],"other")){
    $answer trim($matches[1][$i])."||".trim($matches[3][$i]);
    return 
    $answer;
    }
    }
    //end for

    ///////////////////////////
    for ($i=0$icount($matches[0]); $i++) {
    //if (isset($_POST["random"])){
    $j=count($matches[0])-2;
    $answer trim($matches[1][$j])."||".trim($matches[3][$j]);
    return 
    $answer;
    //}
    }//end for
    ///////////////////////////



    }
    //###########################################################


    }
    ?>
     
    • Thanks Thanks x 3
  2. pauld1

    pauld1 Newbie

    Joined:
    Jan 16, 2011
    Messages:
    31
    Likes Received:
    4
    thanks for this dude, was looking for something like this recently
     
  3. brainet77

    brainet77 Junior Member

    Joined:
    Jun 10, 2008
    Messages:
    112
    Likes Received:
    35
    what kind of article directory, that this script submit to?
     
  4. wickedguy

    wickedguy Supreme Member

    Joined:
    Jul 22, 2009
    Messages:
    1,402
    Likes Received:
    1,379
    Location:
    BHW--> South Africa
    Home Page:
    Please read my first post and you will have your answer.
     
  5. virtualc08

    virtualc08 Supreme Member

    Joined:
    Mar 23, 2010
    Messages:
    1,380
    Likes Received:
    951
    Thanks a lot man .. thanks given :)
     
  6. SEOboss

    SEOboss Junior Member

    Joined:
    Nov 23, 2009
    Messages:
    166
    Likes Received:
    38
    Occupation:
    IM
    Location:
    India
    Thanks I will test it and let you know results
     
  7. edwinteguhn

    edwinteguhn Newbie

    Joined:
    Dec 9, 2009
    Messages:
    34
    Likes Received:
    43
    Home Page:
    maybe any guide hot to use the script?
    Thanks