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

Played around with some Pseudocode

Discussion in 'PHP & Perl' started by Nattsurfaren, Aug 28, 2013.

  1. Nattsurfaren

    Nattsurfaren Regular Member

    Joined:
    Apr 12, 2010
    Messages:
    409
    Likes Received:
    49
    My intention is to work with you to improve it. I know many of you are struggling with SEO ranking and have no clue WTF you're doing wrong. So we need a basic clear understand how to do something. In my experience this is impossible to find. Maybe fraction of it but no blue print.

    I know most of you will probably ignore this but I'm dead certain this will grow to something awesome if we are willing to work with it. I will give it a try and see how many are jumping in on this. Please post comment or suggestion to keep this alive.

    Not finished with the code but here is the first version:

    Code:
    
    <?php
    
    //include_once("phpdump.php");
    
    $AlwaysBlog=true;//Never stop blogging
    $number_of_days_wait="1"; //Example wait '1' day before posting to this blog again.
    
    $primary_keyword="buy bananas";
    $secondary_keyword = "how to eat bananas";
    
    $LSIKeywordList[]="get cheap bananas";
    $LSIKeywordList[]="cheap bananas";
    $LSIKeywordList[]="buy cheap bananas";
    $LSIKeywordList[]="order bananas online";
    
    for($blogcount=0;$blogcount<5;$blogcount++)
    {
        $MyBlogList[] = CreateEmptyBlog(GetRandomWeb20Host(),"Blog$blogcount");
    }
    
    while($AlwaysBlog)
    {
    
        foreach($MyBlogList as $blogid => $CurrentBlog)
        {
            $PostSource = GetPostSource();
            $BlogPost = GetBlogPost($PostSource,$LSIKeywordList);
            $CurrentBlog = CreateBlogPost($CurrentBlog,$BlogPost);
            
            $MyBlogList[$blogid]=$CurrentBlog;
        }
        WaitNumberOfDays($number_of_days_wait);
        
        //dump($MyBlogList);
        exit;
    }
    
    ?>
    
    <?php
    
    function GetPostSource()
    {
        $PostSourceList[]="ezinearticles.com";
        $PostSourceList[]="goarticles.com";
    
        shuffle($PostSourceList);
        return $PostSourceList[0];
    }
    
    function GetBlogPost($PostSource,$LSIKeywordList)
    {
        shuffle($LSIKeywordList);
        $BlogPost = SearchArticle($PostSource,$LSIKeywordList[0]);
        return $BlogPost;
    }
    
    function CreateBlogPost($CurrentBlog,$BlogPost)
    {
        $CurrentBlog["postid"]++;
        $BlogPost["status"]="I successfully posted an article to '".$CurrentBlog["name"]."'";
        $BlogPost["link"]="http://".$CurrentBlog["web 2.0 host"]."/".$CurrentBlog["postid"].".htm";
        $CurrentBlog["posts"][]=$BlogPost;
        return $CurrentBlog;
    }
    
    function SearchArticle($PostSource,$LSIKeyword)
    {
        $article["title"]="Scraped title with keyword '$LSIKeyword' from '$PostSource'";
        $article["text"]="We now have a text about '$LSIKeyword' from '$PostSource'";
        
        return $article;
    }
    
    function CreateEmptyBlog($web20host,$name)
    {
        $blog["name"]=$name;
        $blog["blog title"]="Random title";
        $blog["web 2.0 host"]=$web20host;
        $blog["posts"][]="Default post";
        $CurrentBlog["postid"]=0;
        return $blog;
    }
    
    function GetRandomWeb20Host()
    {
        //List of web 2.0 blogs
        $Web20HostList[]="wordpress.com";
        $Web20HostList[]="blogigo.com";
        $Web20HostList[]="bravejounal.com";
        
        shuffle($Web20HostList);
        return $Web20HostList[0];
    }
    
    function WaitNumberOfDays($number_of_days_wait)
    {
        echo "'$number_of_days_wait' days will now pass before posting again<br>";
    }
    
    ?>
    
    
    
    If you run it you will see how a blog network is made.
    The phpdump tool seams to not exists any more on the web but it is pretty awesome to see the array structure. I recommend you search for a dump script or if you want I can upload it.

    Cheers
     
  2. TheeAriGrande

    TheeAriGrande Regular Member

    Joined:
    Jul 14, 2013
    Messages:
    270
    Likes Received:
    151
    Location:
    Candlestick Park
    What exactly does this code do? It's undocumented and I'm too lazy to analyze it. lol

    Edit: I know it "shows how a blog network is made", but be more specific.
     
    • Thanks Thanks x 2
    Last edited: Aug 28, 2013
  3. LukeX

    LukeX Newbie

    Joined:
    Aug 28, 2013
    Messages:
    19
    Likes Received:
    2
    Location:
    West Coast
    As far as I can figure out only looking over it briefly, it's psuedocode (so not completed) that will grab blog posts randomly
    Code:
    function GetPostSource()[/COLOR]
    {
        $PostSourceList[]=""[REMOVED DUE TO FILTER];
        $PostSourceList[]="[REMOVED DUE TO FILTER]";
    
        shuffle($PostSourceList);
        return $PostSourceList[0];
    }
    
    and then repost it on your "newly generated blog"
    Code:
    function CreateEmptyBlog($web20host,$name)
    {
        $blog["name"]=$name;
        $blog["blog title"]="Random title";
        $blog["web 2.0 host"]=$web20host;
        $blog["posts"][]="Default post";
        $CurrentBlog["postid"]=0;
        return $blog;
    }
    
    allowing you to get "fresh content" for lead generation.

    Apologies if I got that wrong, it was a very brief look...
     
    • Thanks Thanks x 1
  4. Nattsurfaren

    Nattsurfaren Regular Member

    Joined:
    Apr 12, 2010
    Messages:
    409
    Likes Received:
    49
    Thanks guys for responding.
    Firstly it is not finished :)
    Secondly it will have the function of a blue print and not an actual thing that is doing all this. Well it could be an actual thing but the implementation of it already exists as various services on the internet (I'm using one now). What I think people would really see the usefulness of is tweaking the blueprint to make it perfect. With pseudo code you're forced to think what you're doing.
    For example when you read an instruction you will always and often find a crossroad where you don't know which way to take so you improvise. To many improvisations leads to doubt and failure.

    With the settings in the pseudo code we could say: -I had success with x number of blogs with so many tiers and using this and that service and blasting with this and that program using these settings.

    Just think it as a template. We can create templates with all these tweakings and then we can vote for the best template and follow it step by step in real life. It would be really hard to fail because everything is there. Everything that is important will show in the blue print pseudo code. You will have an overview and knowledge on how to implement it because you have both the code and result to see what is actually happening.

    Have you guys tried running it?
    We need to add more stuff to it.

    More tiers
    scrapebox blasting.
    xrumer blasting.
    pinging.
    cloaking perhaps.
    other content sources like rss news sources.
    keyword replacement.

    You will see exactly how it is done.

    Cheers
     
  5. Nattsurfaren

    Nattsurfaren Regular Member

    Joined:
    Apr 12, 2010
    Messages:
    409
    Likes Received:
    49
    You are on the way to get it. Read my post above this. The pseudo code will help you follow logic and apply details where it should be.
     
  6. Nattsurfaren

    Nattsurfaren Regular Member

    Joined:
    Apr 12, 2010
    Messages:
    409
    Likes Received:
    49
    Think of it as a blue print and feel confident that you will grasp the actual function when you study it.
    Also think of it as concentrated information that has been understood by others and understanding it yourself will be a piece of cake because the details is placed exactly where it is meant to be. You will for example exactly know if you should do spinning in the title and how to do the spinning and what software to use.
    If anyone have another suggestion of spinning then we add it. If anything is important to know how to spin something we add it.
     
  7. bartosimpsonio

    bartosimpsonio Jr. VIP Jr. VIP Premium Member

    Joined:
    Mar 21, 2013
    Messages:
    8,896
    Likes Received:
    7,488
    Occupation:
    ZLinky2Buy SEO Services
    Location:
    ⇩⇩⇩⇩⇩⇩⇩⇩⇩⇩⇩⇩
    Home Page:
    print_r($whatever) is used to dump data structures, no need for phpdump.
     
  8. phracktl

    phracktl Regular Member

    Joined:
    Sep 2, 2012
    Messages:
    218
    Likes Received:
    152
    • Thanks Thanks x 1
  9. Nattsurfaren

    Nattsurfaren Regular Member

    Joined:
    Apr 12, 2010
    Messages:
    409
    Likes Received:
    49

    Lets make it better by making it executable. :)
    Lets not make thunder and lightning because I changed it a little bit :)
     
    • Thanks Thanks x 1
  10. phracktl

    phracktl Regular Member

    Joined:
    Sep 2, 2012
    Messages:
    218
    Likes Received:
    152
    Hey no thunder from me...i was being pedantic, as i said. Actually there were interesting attempts years ago to make pseudocode executable. Then Guido made the Python, and the rest is history ;-)

    I read your code and its interesting to me - but i dont have the IM chops to see how it fits in with other tools (im not using external tools, but then im not doing seo). Interested to see where youre going with this though

    best
     
    • Thanks Thanks x 1
  11. Nattsurfaren

    Nattsurfaren Regular Member

    Joined:
    Apr 12, 2010
    Messages:
    409
    Likes Received:
    49
    For your convenience I have uploaded the script to a hosting:
    http://nattsurf.comuf.com/

    This is using phpdump.
    print_r will just give you a headache unless you really love print_r :)
     
  12. Nattsurfaren

    Nattsurfaren Regular Member

    Joined:
    Apr 12, 2010
    Messages:
    409
    Likes Received:
    49
    Added:
    Use of second tier.
    Ability to link to the first tier.
    Added form handling in the demo.

    I did a very simple link to tier function and it will add a link to tier 1. The link will be placed at the end of the text. Now I would really like your input of what to add/change. It is just awesome that you know exactly how I think and it is so easy for you to explain what you want. We can then play with this and make it even more powerful.

    Here is a demo:
    http://nattsurf.comuf.com/index.php

    Here is the code update:

    Code:
    <?php
    
    include_once ("phpdump.php");
    
    $AlwaysBlog = true;//Never stop blogging
    $number_of_days_wait = "1";//Example wait '1' day before posting to this blog again.
    
    $primary_keyword = "buy bananas";
    $secondary_keyword = "how to eat bananas";
    
    $LSIKeywordList[] = "get cheap bananas";
    $LSIKeywordList[] = "cheap bananas";
    $LSIKeywordList[] = "buy cheap bananas";
    $LSIKeywordList[] = "order bananas online";
    
    $number_of_blogs_tier_1 = 5;
    $number_of_blogs_tier_2 = 0;
    $Link2Tier1=false;
    
    if (isset($_REQUEST["submit"]))
    {
        if (isset($_REQUEST["numblogs1"]))
        {
            $number_of_blogs_tier_1 = $_REQUEST["numblogs1"];
        }
        if (isset($_REQUEST["numblogs2"]))
        {
            $number_of_blogs_tier_2 = $_REQUEST["numblogs2"];
        }
        
        if (isset($_REQUEST["Link2Tier1"]))
        {
            $Link2Tier1 = $_REQUEST["Link2Tier1"];
        }
    }
    
    
    
    
    ?>
    
    <form method="GET"  action="<?php echo $_SERVER['PHP_SELF']; ?>">
    <label>Number of blogs for tier 1</label><br>
    <input name="numblogs1" value="<?php echo $number_of_blogs_tier_1; ?>"><br>
    <label>Number of blogs for tier 2</label><br>
    <input name="numblogs2" value="<?php echo $number_of_blogs_tier_2; ?>"><br><br>
    <br>
    <input type="checkbox" name="Link2Tier1" value="Link" <?php echo $Link2Tier1?"checked":"";?>>Link from Tier 2 to Tier 1 with links from Tier 1<br>
    <input type="submit"  name="submit" value="Run">
    </form>
    
    
    <?php
    if ($number_of_blogs_tier_1 > 0)
    {
        $MyTieredBlogList = CreateEmptyBlogsForTier("1", $number_of_blogs_tier_1);
    }
    if ($number_of_blogs_tier_2 > 0)
    {
        $MyTieredBlogList = CreateEmptyBlogsForTier("2", $number_of_blogs_tier_2, $MyTieredBlogList);
    }
    
    while ($AlwaysBlog)
    {
        if ($number_of_blogs_tier_1 > 0)
        {
            $MyTieredBlogList = CreateASetOfBlogPosts("1", $MyTieredBlogList, $primary_keyword,
                $secondary_keyword, $LSIKeywordList);
        }
        if ($number_of_blogs_tier_2 > 0)
        {
            dump("ok");
            $MyTieredBlogList = CreateASetOfBlogPosts("2", $MyTieredBlogList, $primary_keyword,
                $secondary_keyword, $LSIKeywordList);
        }
        WaitNumberOfDays($number_of_days_wait);
    
        dump($MyTieredBlogList);
        exit;
    }
    
    ?>
    
    <?php
    
    
    function CreateASetOfBlogPosts($tiernumber, $MyBlogList, $primary_keyword, $secondary_keyword,
        $LSIKeywordList)
    {
        foreach ($MyBlogList["Tier " . $tiernumber] as $blogid => $CurrentBlog)
        {
            $PostSource = GetPostSource();
            $BlogPost = GetBlogPost($PostSource, $LSIKeywordList);
            
            if (isset($_REQUEST["Link2Tier1"]))
            {
                if($tiernumber>1)
                {
                    $BlogPost=AddRandomLinkFromTierToTierAtTheEnd($MyBlogList,$BlogPost,$tiernumber,"1");
                }
            }
            $CurrentBlog = CreateBlogPost($CurrentBlog, $BlogPost, $tiernumber);
    
            $MyBlogList["Tier " . $tiernumber][$blogid] = $CurrentBlog;
        }
        return $MyBlogList;
    }
    
    function AddRandomLinkFromTierToTierAtTheEnd($MyBlogList,$BlogPost,$ThisTier,$DestinationTier)
    {
        $list_of_links=array();
        foreach($MyBlogList["Tier " .$DestinationTier] as $Blog)
        {
            foreach($Blog["posts"] as $Post)
            {
                if(strpos($Post["link"],"://")!==false)
                {
                    $list_of_links[]=$Post["link"];
                }
            }
        }
        shuffle($list_of_links);
        
        $BlogPost["text"].="\r\n".$list_of_links[0];
        return $BlogPost;
    }
    
    function CreateEmptyBlogsForTier($tiernumber, $number_of_blogs_tier, $MyBlogList =
        array())
    {
        for ($blogcount = 0; $blogcount < $number_of_blogs_tier; $blogcount++)
        {
            $MyBlogList["Tier " . $tiernumber][] = CreateEmptyBlog(GetRandomWeb20Host(),
                "Blog$blogcount");
        }
    
        return $MyBlogList;
    }
    
    function GetPostSource()
    {
        $PostSourceList[] = "ezinearticles.com";
        $PostSourceList[] = "goarticles.com";
    
        shuffle($PostSourceList);
        return $PostSourceList[0];
    }
    
    function GetBlogPost($PostSource, $LSIKeywordList)
    {
        shuffle($LSIKeywordList);
        $BlogPost = SearchArticle($PostSource, $LSIKeywordList[0]);
        return $BlogPost;
    }
    
    function CreateBlogPost($CurrentBlog, $BlogPost, $TierNumber="1")
    {
        $CurrentBlog["postid"]++;
        $BlogPost["status"] = "I successfully posted an article to '" . $CurrentBlog["name"] .
            "'";
        $BlogPost["link"] = "http://" . $CurrentBlog["web 2.0 host"]. "/" . $CurrentBlog["name"] ."Tier$TierNumber" .
            "/" . $CurrentBlog["postid"] . ".htm";
        $CurrentBlog["posts"][] = $BlogPost;
        return $CurrentBlog;
    }
    
    function SearchArticle($PostSource, $LSIKeyword)
    {
        $article["title"] = "Scraped title with keyword '$LSIKeyword' from '$PostSource'";
        $article["text"] = "We now have a text about '$LSIKeyword' from '$PostSource'\r\nword1 word2 word3 word4 word5 word6";
    
        return $article;
    }
    
    function CreateEmptyBlog($web20host, $name)
    {
        $blog["name"] = $name;
        $blog["blog title"] = "Random title";
        $blog["web 2.0 host"] = $web20host;
        $blog["posts"][] = "Default post";
        $CurrentBlog["postid"] = 0;
        return $blog;
    }
    
    function GetRandomWeb20Host()
    {
        //List of web 2.0 blogs
        $Web20HostList[] = "wordpress.com";
        $Web20HostList[] = "blogigo.com";
        $Web20HostList[] = "bravejounal.com";
    
        shuffle($Web20HostList);
        return $Web20HostList[0];
    }
    
    function WaitNumberOfDays($number_of_days_wait)
    {
        echo "'$number_of_days_wait' days will now pass before posting again<br>";
    }
    
    ?>
    
    
     
  13. Domo_18895

    Domo_18895 Newbie

    Joined:
    Jan 29, 2013
    Messages:
    34
    Likes Received:
    11
    An attempt at a open source IM tool? Like to help but don't know php :(
     
    • Thanks Thanks x 1
    Last edited: Aug 29, 2013
  14. Archemike

    Archemike Regular Member

    Joined:
    Jan 12, 2012
    Messages:
    221
    Likes Received:
    42

    Pseudo code is simply a logical expression,

    Fetch blog post from URL via rss

    Shuffle content by pushing to an array switching order then using implode into a string.

    Http post using curl to .comments.pup with credentials for auto approve.

    Create cronjob to run at 5am every morning.

    This is a procedural script even though there is no correct syntax, it describes the semantics, you could use Google and stack overflow to fill it out... Cheers
     
    • Thanks Thanks x 1
  15. Nattsurfaren

    Nattsurfaren Regular Member

    Joined:
    Apr 12, 2010
    Messages:
    409
    Likes Received:
    49
    Maybe in the future. For now it is just to simplify the how to.
     
  16. phracktl

    phracktl Regular Member

    Joined:
    Sep 2, 2012
    Messages:
    218
    Likes Received:
    152
    • Thanks Thanks x 1
  17. Nattsurfaren

    Nattsurfaren Regular Member

    Joined:
    Apr 12, 2010
    Messages:
    409
    Likes Received:
    49
    I would like to some input from you guys. If you run the demo you can see the structure:
    First we have the tiers and then each tier has a set of blogs and each blog has a set of posts.
    We are building a simulation and I would like to add some more to this simulation.
    For example the link to tier 1 check box did you try it?
    Did you see how it added a link to all tier 2 blog posts?
    Is that a good simulation? I think not. There is much stuff missing.