How Do I test 2 Landing Pages? PHP not working for me...

Discussion in 'ClickBank' started by rickybuitrago, Sep 20, 2008.

  1. #1
    Tried this thread on Web Design but not getting help so I thought since my LPs are for clickbank products...you guys could help...

    Hey,

    I heard of a method using a PHP code that should be pasted on the index file and then the code would redirect to 2 lanidng pages randomley. I used the code, but didnt work, it wasent redirecting visitors - the page appeared blank.

    This was the code:

    <?php
    if(rand(0,1) == 0) {
    header("Location: http://www.example.com/split1");
    } else {
    header("Location: http://www.example.com/split2");
    }
    ?>


    What am I doing wrong? I changed the urls to mine and the filneames and added the html extensions....

    Where exactly should I paste the code? Im new to html to maybe the code is in the wrong place of my source...
    Thanks!!!
     
    rickybuitrago, Sep 20, 2008 IP
  2. Ripped

    Ripped Well-Known Member

    Messages:
    2,151
    Likes Received:
    55
    Best Answers:
    0
    Trophy Points:
    165
    #2
    Copy and paste the exact code you used, so I can see what you did wrong,
    Also make sure you use a hosting service which allows PHP, most of the free services don't support PHP, if you're using a paid hosting, then you don't have to worry about that
     
    Ripped, Sep 20, 2008 IP
  3. rickybuitrago

    rickybuitrago Peon

    Messages:
    170
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Yes Im using paid hosting...hostgator.

    The exact PHP code I used was:

    <?php
    if(rand(0,1) == 0) {
    header("Location: http://www.myaffiliatsite.com/split1.html");
    } else {
    header("Location: http://www.myaffiliatesite.com/split2.html");
    }
    ?>

    Do I need to save my index file as index.php maybe...?
     
    rickybuitrago, Sep 20, 2008 IP
  4. singaporeboyracer.com

    singaporeboyracer.com Peon

    Messages:
    569
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #4
    what did you save it as initially? .html ?
     
    singaporeboyracer.com, Sep 20, 2008 IP
  5. rickybuitrago

    rickybuitrago Peon

    Messages:
    170
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    What I did was I opened a new page in my webiste builder and then I went to source and pasted the code (with my LP urls) and then saved the file as index. So I guess it saved as html? Im new to this...
     
    rickybuitrago, Sep 20, 2008 IP
  6. Supper

    Supper Peon

    Messages:
    1,539
    Likes Received:
    22
    Best Answers:
    0
    Trophy Points:
    0
    #6
    <?php
    if(rand(0,1) == 0)
    include("page1.php");
    else
    include("page2.php">; }?>
     
    Supper, Sep 20, 2008 IP
  7. Ripped

    Ripped Well-Known Member

    Messages:
    2,151
    Likes Received:
    55
    Best Answers:
    0
    Trophy Points:
    165
    #7
    Ripped, Sep 20, 2008 IP
  8. rickybuitrago

    rickybuitrago Peon

    Messages:
    170
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    I saw this code also before but...
    Shouldn't I include the full urls? just "filename.php"?
    My LPs are html, should I still include .php as extension?

    What is the difference between this code and the one I tried before? I heard the one I tried should of worked...any ideas?

    Thanks!
     
    rickybuitrago, Sep 20, 2008 IP
  9. Madman340

    Madman340 Peon

    Messages:
    231
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Create index.php and put that script in it, and then leave it as you had it at first.
     
    Madman340, Sep 20, 2008 IP
  10. rickybuitrago

    rickybuitrago Peon

    Messages:
    170
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    so basically I just save the page as index.php ? I mean is that the way I create a php...by saving it as .php?
     
    rickybuitrago, Sep 20, 2008 IP
  11. Madman340

    Madman340 Peon

    Messages:
    231
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #11
    Yes, that is how you make a regular HTML file into a PHP file.

    The difference is, it needs to be on the server to work, you can't test it locally without extra software.
     
    Madman340, Sep 20, 2008 IP
  12. Ripped

    Ripped Well-Known Member

    Messages:
    2,151
    Likes Received:
    55
    Best Answers:
    0
    Trophy Points:
    165
    #12
    yes, I forgot to add, if you're testing it on your PC this won't work, you need to run the php file via a server, so upload it to your web hosting account and try it, if you just open it from your pc it wont show anything
     
    Ripped, Sep 20, 2008 IP
  13. Madman340

    Madman340 Peon

    Messages:
    231
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #13
    Also, I'm not sure if what I'm saying will work, I don't even know PHP. :p

    I'd think it should work though.
     
    Madman340, Sep 20, 2008 IP
  14. rickybuitrago

    rickybuitrago Peon

    Messages:
    170
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #14
    Guys...can´t get this working! I did as told...copied the code to a blank page...saved it as index.php and uploaded it to servers (I deleted index.html - my old homepage), and an error shows up when trying to access the page...what could i be doing wrong??? Also, when I fisrt uploaded index.php, it appeared as index.php.html, so I deleted the html extensio from it...is that ok?

    Should I add the php extensio to the two landing pages also??????????

    using this code:
    <?php
    if(rand(0,1) == 0) {
    header("Location: http://www.myaffiliatsite.com/split1.html");
    } else {
    header("Location: http://www.myaffiliatesite.com/split2.html");
    }
    ?>



    million thanks!
     
    rickybuitrago, Sep 20, 2008 IP
  15. web_18designer

    web_18designer Peon

    Messages:
    790
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #15

    If you didnt sorted it out already, you are doing everything fine except that you are redirecting to pages that does not exists:

    You should already know that the above code just generate a random number between 0 and 1.

    If 0 is generated it redirects to http://www.myaffiliatsite.com/split1.html otherwise to http://www.myaffiliatsite.com/split2.html

    All is fine however you must be sure that the pages: split1.html and split2.html exists for real.

    If the extension is different, they are different pages: split1.php and split1.html are totally different.

    So you are basically redirecting to a page that does not exists.

    Im being simple just so you can be sure to understand whats going on...

    Good Luck!
     
    web_18designer, Sep 20, 2008 IP
  16. web_18designer

    web_18designer Peon

    Messages:
    790
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #16
    Buddy, First you must enable file extension on your computer. windows have a setting that hide the extension for known file types and this can be really frustrating. Go to http://answers.yahoo.com/question/index?qid=20080611014420AA4n3go for instructions how to show the extensions of your files first so that you will know the exact the name & extensions of your files.


    With your code you are redirecting to either split1.html or split2.html so your pages must be named exactly like that. Understand?
     
    web_18designer, Sep 20, 2008 IP
  17. Ripped

    Ripped Well-Known Member

    Messages:
    2,151
    Likes Received:
    55
    Best Answers:
    0
    Trophy Points:
    165
    #17
    It would be better if you gave us the real domain of your site, and the real link paths that you're using
     
    Ripped, Sep 20, 2008 IP
  18. rickybuitrago

    rickybuitrago Peon

    Messages:
    170
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #18
    web_18designer : split1.html and split2.html already exist, those are filenames I already uploaded....if I type http://www.myaffiliatesite.com/split1.html my LP #1 shows up - same with split2...but the index.php page is not redirecting to either split1 or split 2, although they exist and are named exactly like that.
     
    rickybuitrago, Sep 20, 2008 IP
  19. rickybuitrago

    rickybuitrago Peon

    Messages:
    170
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #19
    This message appears when when trying to access homepage:


    Warning: Cannot modify header information - headers already sent by (output started at /home/username/public_html/myaffiliatesite.com/index.php:16) in /home/usernamei/public_html/myaffiliatesite.com/index.php on line 19
     
    rickybuitrago, Sep 20, 2008 IP
  20. Madman340

    Madman340 Peon

    Messages:
    231
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #20
    Okay, here, I just did it myself and its working.

    (site i just started working on)
    http://simpledetour.com/gothere.php

    As you can see, that is my .php file that links to 1 of 2 places, either split1 or split2

    This is the script I used:

    <?php
    if(rand(0,1) == 0) {
    include("http://www.simpledetour.com/split1.html");
    } else {
    include("http://www.simpledetour.com/split2.html");
    }
    ?>


    Refresh the page a lot and you will see it switches between 1 and 2.
     
    Madman340, Sep 20, 2008 IP