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

How to install a PHP script with cPanel?

Discussion in 'BlackHat Lounge' started by TermsB, Jun 11, 2009.

  1. TermsB

    TermsB Senior Member

    Joined:
    May 19, 2009
    Messages:
    1,076
    Likes Received:
    734
    Location:
    USA
    Okay so this kinda sucks to have to ask but I can't seem to find anywhere online or on here how to install PHP scripts into cPanel X. I tried to run it by installing PHP on my XP machine but the PHP seemed totally unresponsive. So I was wondering how I can add it to my cPanel on my host. Leave a message here or message me on my AIM. Thank you for your time and thanks will be given.

    The script I'm trying to know how to do is:

    Code:
    http://www.blackhatworld.com/blackhat-seo/hire-freelancer/89678-looking-someone-code-simple-twitter-program.html
     
    Last edited: Jun 11, 2009
  2. seikooc

    seikooc Regular Member

    Joined:
    Aug 11, 2008
    Messages:
    268
    Likes Received:
    132
    Occupation:
    BH Implementation
    Location:
    Blackhat World
    Well make sure your host has PHP enabled which 90% of the good ones do. Then just upload the files which should have been saved as he described: Put follow.txt (which is for the first file, note .txt) and the following (name it follow.php)(which is the second code, note .php) php script in the same directory
     
    • Thanks Thanks x 1
  3. TermsB

    TermsB Senior Member

    Joined:
    May 19, 2009
    Messages:
    1,076
    Likes Received:
    734
    Location:
    USA
    I got that far, but than on how to run it I have no idea. :smashfrea

    I see that I should be typing the "php follow.php" into somewhere, but I don't know where. That's as far as I got before posting.
     
    Last edited: Jun 11, 2009
  4. thedorf

    thedorf Senior Member

    Joined:
    Oct 1, 2008
    Messages:
    1,193
    Likes Received:
    700
    Occupation:
    what? I gotta have a job?
    Location:
    BHW - Where else?
    you probably do not have shell access

    call the php file directly from your web broswer - after uploading the two files to your public_html directory. You may have to change file permissions, dunno your setup

    to make sure it works throw this in before "?>"

    echo 'all done';
     
    • Thanks Thanks x 1
  5. TermsB

    TermsB Senior Member

    Joined:
    May 19, 2009
    Messages:
    1,076
    Likes Received:
    734
    Location:
    USA
    I'm thinking I don't have the access you're talking about, when I uploaded follow.php it renamed it to follow.php.txt. Or am I messing something up when saving the file in Notepad?
     
  6. thedorf

    thedorf Senior Member

    Joined:
    Oct 1, 2008
    Messages:
    1,193
    Likes Received:
    700
    Occupation:
    what? I gotta have a job?
    Location:
    BHW - Where else?
    that is notepad - just rename the file inside the cpanel file manager to follow.php
     
    • Thanks Thanks x 1
  7. seikooc

    seikooc Regular Member

    Joined:
    Aug 11, 2008
    Messages:
    268
    Likes Received:
    132
    Occupation:
    BH Implementation
    Location:
    Blackhat World
    I am not sure why it renamed it to .txt .... you should have 2 files that you are uploading or FTP 'ing to your server. One is .txt and one is .php ... Right???
     
    • Thanks Thanks x 1
  8. TermsB

    TermsB Senior Member

    Joined:
    May 19, 2009
    Messages:
    1,076
    Likes Received:
    734
    Location:
    USA
    After changing the filename to follow.php instead of follow.php.txt it ran, but now it's just giving an Syntax Error on Line 8. So maybe Twitter has changed since he wrote the script? :p Such a hastle not knowing if I'm doing things right. Thanks for both your help.
     
  9. thedorf

    thedorf Senior Member

    Joined:
    Oct 1, 2008
    Messages:
    1,193
    Likes Received:
    700
    Occupation:
    what? I gotta have a job?
    Location:
    BHW - Where else?
    try it with just one user in the .txt file

    and make sure you are changing line 8 to include YOUR username and password with the ":" between them

    or pm me line 8 (minus user:passwd) and I'll take a look
     
    • Thanks Thanks x 1
  10. seikooc

    seikooc Regular Member

    Joined:
    Aug 11, 2008
    Messages:
    268
    Likes Received:
    132
    Occupation:
    BH Implementation
    Location:
    Blackhat World
    Yeah I think it's a small error in the script you posted like thedorf said. At least you're making progress :)
     
    • Thanks Thanks x 1
  11. TermsB

    TermsB Senior Member

    Joined:
    May 19, 2009
    Messages:
    1,076
    Likes Received:
    734
    Location:
    USA
    Well my username and password are in the corrent format, no typos, maybe I'm using the wrong naming format in the follow.txt, I am trying to use this format:

    Code:
    oprah
    
    Since it's http://twitter.com/oprah Am I using the right naming format in the follow.txt? Ha.
     
  12. seikooc

    seikooc Regular Member

    Joined:
    Aug 11, 2008
    Messages:
    268
    Likes Received:
    132
    Occupation:
    BH Implementation
    Location:
    Blackhat World
    I think you are... did you edit line 8 in PHP??

    How is it looking now?
     
    • Thanks Thanks x 1
  13. thedorf

    thedorf Senior Member

    Joined:
    Oct 1, 2008
    Messages:
    1,193
    Likes Received:
    700
    Occupation:
    what? I gotta have a job?
    Location:
    BHW - Where else?
    try putting a newline/carriage return after the username but no spaces on the second line and no spaces after the username - the cursor should be on the second line but nothing actually on the second line (this is in follow.txt)
     
    • Thanks Thanks x 1
  14. TermsB

    TermsB Senior Member

    Joined:
    May 19, 2009
    Messages:
    1,076
    Likes Received:
    734
    Location:
    USA
    I did edit it as directed.

    Code:
    $url = "http://My_Usernameishere:mypassishere@twitter.com/friendships/create/$username.json";
    Tried leaving a blank line for Line 2 as you said, it didn't appear to have affected it any for the positive.

    Hmm. Feel like I'm wasting both your time. Heh.
     
    Last edited: Jun 11, 2009
  15. thedorf

    thedorf Senior Member

    Joined:
    Oct 1, 2008
    Messages:
    1,193
    Likes Received:
    700
    Occupation:
    what? I gotta have a job?
    Location:
    BHW - Where else?
    hmmm, last thing I'll suggest is remove and then replace the double quotes. Sounds strange I know but try it. Just delete the double quotes and replace them - both of 'em.
     
    • Thanks Thanks x 1
  16. thedorf

    thedorf Senior Member

    Joined:
    Oct 1, 2008
    Messages:
    1,193
    Likes Received:
    700
    Occupation:
    what? I gotta have a job?
    Location:
    BHW - Where else?
    You can also try this (put in your usename /pw )

    Code:
    $url = "http://My_Usernameishere:mypassishere@twitter.com/friendships/create/".$username.".json";
     
  17. TermsB

    TermsB Senior Member

    Joined:
    May 19, 2009
    Messages:
    1,076
    Likes Received:
    734
    Location:
    USA
    Okay well I get this now after replacing all the quotes. Both of the lines original and the one you suggest to me have this effect. Once again I do appreciate the help. If you do help me find the answer I can slide some money your way.

    [​IMG]
     
  18. seikooc

    seikooc Regular Member

    Joined:
    Aug 11, 2008
    Messages:
    268
    Likes Received:
    132
    Occupation:
    BH Implementation
    Location:
    Blackhat World
    Yeah it looks like the quotations are necessary... Are you using a program like dreamweaver to change the PHP code???
     
  19. TermsB

    TermsB Senior Member

    Joined:
    May 19, 2009
    Messages:
    1,076
    Likes Received:
    734
    Location:
    USA
    Right now I am just editing the PHP through my cPanel.
     
  20. thedorf

    thedorf Senior Member

    Joined:
    Oct 1, 2008
    Messages:
    1,193
    Likes Received:
    700
    Occupation:
    what? I gotta have a job?
    Location:
    BHW - Where else?
    try changing:

    curl_setopt($curld, CURLOPT_GET, true);

    to:

    curl_setopt($curld, CURLOPT_POST, true);

    or secondly try:

    curl_setopt($curld, CURLOPT_GET, false);

    and if that don't work go here and read up:

    Code:
    http://apiwiki.twitter.com/Twitter-REST-API-Method:-friendships%C2%A0create
    good luck I'm outta here! If you still have trouble pm me and I'll check you out tomorrow.


    OK and I will add the loop appears to be executing twice and there is no second user to add...
     
    Last edited: Jun 11, 2009