Article Marketers - Spun Article Checker Script

6 replies
Hi Warriors,

For those of you who spin articles, it can be a total pain to correct articles when you leave out a closing '}' or there is a stray '|' in between. I've attached a script which allows you to check if an article has properly balanced opening and closing curly brackets.

Do not run this on your server.

Rename the file to tester.php. You have to install php in your computer and run it using command line. Copy this file to the directory containing the article text files and use the following syntax:

php tester.php filename.txt

If you see "perfect!" as the output - your article is perfectly balanced. If not, you will be given a list of lines where the starting brace is not closed or where there is a stray '|'.

Hope you find it useful.

Raja Sekharan
#article #checker #marketers #script #spun
  • Profile picture of the author TheRichJerksNet
    This is the exact reason the system I use you do not have to type in any } - I personally like things more automative and when just clicking on a link adds the alternative for you it is a much better way to go...

    Hope your file helps those that still do manually type in }

    James
    {{ DiscussionBoard.errors[353233].message }}
  • Profile picture of the author joetango
    Hi,

    Thanks Raja, this was helpful. There was a small error in the code which I corrected (see comments in code).

    Here's the script:

    Code:
    <?php
    
     = ;
    // = ;
    
     = fopen(,"r");
     = array();
    =0;
    0 = 0;
    while (!feof())
    {
          = fgetc();
         ++;
         if ( == "|" && 0<=0)
         {
             
              echo "Unexpected |.";
               = array();
              break;   
    
         }
    
         if ( == "{")
         {
             array_push(,);
             0++; // = 1;
         }
    
         if ( == "}")
         {
            if (count() == 0)
            {
                print "Excess } at nn";
                 = array();
                break;
            }
            0--; // = 0;
            array_pop();
         }
    
    }
    fclose();
    if (count() == 0 )
    echo "perfect!";
    
     = file_get_contents();
    
    foreach ( as )
    {
        echo substr(,,100)."nn";
    }
    ?>
    {{ DiscussionBoard.errors[3981081].message }}
  • Profile picture of the author protectyoursales
    I always thought that most spinners these days have an auto syntax checker. I know TBS does and SpinnerChief too. I suppose there are a plethora of other products out there though, and I always love me a good PHP script.

    Great share!
    {{ DiscussionBoard.errors[5620387].message }}
  • Profile picture of the author BenShaffer
    The problem with the built in checkers I found was that it was hard to actually find your mistakes and debug them.
    Especially when you are dealing with hundreds of articles like we are makes it far easier to be able to debug all in one place. Also, this deals with any type of spintax and (almost) unlimited nested levels.

    B
    {{ DiscussionBoard.errors[5620420].message }}

Trending Topics