I need a script that will do this - Will pay $3 for help

Discussion in 'Programming' started by paxis, Mar 29, 2008.

  1. #1
    Alright, I have an article website that I want to monetize a certain way. I would like a script that would allow keywords of my choice to be linked to a website of my choice.

    For example: everytime the keyword 'hosting' shows up on my website, I want it linked to my affiliate link for HostGator.

    I briefly searched Google and hotScripts, didnt see anything, and os will pay $3 to the first person who links me to a script like this (PayPal). I prefer the script to be free. Thanks
     
    paxis, Mar 29, 2008 IP
  2. Xtrm2Matt

    Xtrm2Matt Active Member

    Messages:
    129
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    58
    #2
    It's not the most practical way of doing it, but:

    <<--- SEE BELOW --->>
    PHP:
    This is very limited, as it'll only allow you to replace one word as far as I remember. I'll try and find a better example.

    EDIT:

    <?php
    $string = "blah blah blah hostgator andanother: Xtrm2Matt";
    $string = str_replace( "hostgator", "<a href=\"http://www.hostgator.com\">hostgator</a>", $string );
    $string = str_replace( "Xtrm2Matt", "<a href=\"http://www.Xtrm2Matt.com\">Xtrm2Matt</a>", $string );
    echo $string;
    ?>
    PHP:
     
    Xtrm2Matt, Mar 29, 2008 IP
  3. paxis

    paxis Peon

    Messages:
    80
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I really need something that will allow me to place some javascript on the top of the file, similair to intellitxt or kontera - only for me own affiliate links.

    Also, I got the following error when I ran that code:
    Parse error: syntax error, unexpected T_VARIABLE in C:\wamp\www\links.php on line 3


    +rep for the assistance though
     
    paxis, Mar 29, 2008 IP
  4. Finney

    Finney Peon

    Messages:
    458
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I understand what you are on about.. Give me a minute and Ill do it.
     
    Finney, Mar 29, 2008 IP
  5. Finney

    Finney Peon

    Messages:
    458
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #5
    <?php

    // The text string
    $text = "All Content here saying hosting";

    // The word we want to replace
    $oldWord = "hosting";

    // The new word we want in place of the old one
    $newWord = "<a href=www.hostgator.com.com>hosting</a>";

    // Run through the text and replaces all occurrences of $oldText
    $text = str_replace($oldWord , $newWord , $text);

    // Display the new text
    echo $text;

    ?>


    Hope this helps, with understanding comments.


    Regards,
    Finney
     
    Finney, Mar 29, 2008 IP
  6. Finney

    Finney Peon

    Messages:
    458
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Simple put all your code into $text = " code here ";
     
    Finney, Mar 29, 2008 IP
    paxis likes this.
  7. Xtrm2Matt

    Xtrm2Matt Active Member

    Messages:
    129
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    58
    #7
    Updated my post with a sniplet of code I found in one of my old scripts. That way, you can have a list of things you want to change:

    <?php
    $string = "blah blah blah hostgator andanother: Xtrm2Matt";
    $string = str_replace( "hostgator", "<a href=\"http://www.hostgator.com\">hostgator</a>", $string );
    $string = str_replace( "Xtrm2Matt", "<a href=\"http://www.Xtrm2Matt.com\">Xtrm2Matt</a>", $string );
    echo $string;
    ?>
    PHP:
    That's PHP anyway. As for javascript, the closest I can get is:

    <script type="text/javascript">
    var str="blah blah blah hostgator";
    document.write(str.replace(/hostgator/g, "<a href=\"http://www.hostgator.com\">hostgator</a>")
    </script>
    Code (markup):
    Now this is restricted. I don't know how you'd use this for multiple replaces. Perhaps someone can go from this :)
     
    Xtrm2Matt, Mar 29, 2008 IP
  8. paxis

    paxis Peon

    Messages:
    80
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #8
    @Finney

    Thanks, but I would need to replace multiple words on each page. It would also be something I need to embed in my article directory script (articledashboard.com)
     
    paxis, Mar 29, 2008 IP
  9. paxis

    paxis Peon

    Messages:
    80
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #9
    All of these would work perfect for a static site or possibly a blog. For my site though (using the articledashboard.com script) people post their article through the scripts predefined methods and I do not have access to the script code (obfuscated) so I can't see what is handling the article text to pass it into the $string variable.
     
    paxis, Mar 29, 2008 IP
  10. Xtrm2Matt

    Xtrm2Matt Active Member

    Messages:
    129
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    58
    #10
    Don't know what else to suggest, sorry! I'll be watching the thread if someone manages to come up with a solution, though :)
     
    Xtrm2Matt, Mar 29, 2008 IP
  11. Finney

    Finney Peon

    Messages:
    458
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #11
    Similar to paxis's..

    <?php

    // The text string
    $text = "All Content here";

    // The word we want to replace
    $oldWord = "hosting";
    $oldWord2 = "google";
    $oldWord3 = "yahoo";

    // The new word we want in place of the old one
    $newWord = "<a href=www.hostgator.com>hosting</a>";
    $newWord2 = "<a href=www.google.com>google</a>";
    $newWord3 = "<a href=www.yahoo.co.uk>yahoo</a>";

    // Run through the text and replaces all occurrences of $oldText
    $text = str_replace($oldWord , $newWord , $text);
    $text = str_replace($oldWord2 , $newWord2 , $text);
    $text = str_replace($oldWord3 , $newWord2 , $text);

    // Display the new text
    echo $text;

    ?>
     
    Finney, Mar 29, 2008 IP
  12. Finney

    Finney Peon

    Messages:
    458
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #12
    That code above should work, not 100% positive has I havent tested.
     
    Finney, Mar 29, 2008 IP
  13. paxis

    paxis Peon

    Messages:
    80
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #13
    The problem is I can't edit the code to put the content into the $string variable
     
    paxis, Mar 29, 2008 IP
  14. Finney

    Finney Peon

    Messages:
    458
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #14
    Simple put

    <?php $text = "
    Code (markup):
    at the start of your source and then

    "; ?>
    Code (markup):
    at the end of your source. You may have to change all your HTML's " into ' though. Sorry.
     
    Finney, Mar 29, 2008 IP
  15. paxis

    paxis Peon

    Messages:
    80
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #15
    The reason I can't do it is because the code is obfuscated :D that is why I was looking more to included a javascipt type widget similiar to IntelliTXT
     
    paxis, Mar 29, 2008 IP
  16. Yuffles

    Yuffles Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #16
    I found a guide that showed you how to do one on the internet somewhere. I attatched an example file on what to do. This is fairly simple, you should be able to figure it out from here.

    I am not sure about upload policy here so I just used the forum built in one. :confused:
     

    Attached Files:

    Yuffles, Mar 29, 2008 IP
  17. paxis

    paxis Peon

    Messages:
    80
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #17
    PMed you...
     
    paxis, Mar 31, 2008 IP
  18. anton-io!

    anton-io! Active Member

    Messages:
    540
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    58
    #18
    This is a nice post, thanks for the share.

    Never considered this with ArticleDashboard, but a great idea!!! :D
     
    anton-io!, May 7, 2008 IP
  19. enomsoft

    enomsoft Peon

    Messages:
    128
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #19
    i think he is not a developer
     
    enomsoft, May 8, 2008 IP