Create config script to hide actual url

Discussion in 'PHP' started by mark103, Sep 18, 2010.

  1. #1
    Hi guys,

    I want to create php script to connect to another php script on another site while hide the url in the config php, something is like this:


    <?php
    
    $mysql = array
    (
        'host' => 'http://www.mysite.com/myscript.php',
    } 
    PHP:


    <?php
    
    try
    {
        include_once('mysql_connect.php');
    }
    PHP:

    Is the source code is correct to use that I want to read the script while hide the actual url in the config php script??



    Thanks,
    Mark
     
    mark103, Sep 18, 2010 IP
  2. dreamconception

    dreamconception Peon

    Messages:
    55
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I don't really understand what you need. It seams about right though. Just an include statement.

    You mean hide from outside users, or hide in the actual PHP code?
     
    dreamconception, Sep 18, 2010 IP
  3. mark103

    mark103 Active Member

    Messages:
    110
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    53
    #3
    Yes, I mean to hide the url from outside users. Is it possible to store the url secure similar as config??
     
    mark103, Sep 19, 2010 IP
  4. dreamconception

    dreamconception Peon

    Messages:
    55
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    URL's in PHP will never been shown to outside users unless you do echo or similar.

    If you just do an include statement it shouldn't be shown at all. Only way that could happen is if in the included file there is some content being printed out that states the actual file name.
     
    dreamconception, Sep 19, 2010 IP
  5. mark103

    mark103 Active Member

    Messages:
    110
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    53
    #5
    Ok, so should I use something like this to hide the url in config.php:

     echo "<a target=frame2 href='" ."http://www.example.com/myscript.php"</a>"; 
    PHP:

    Or if I should this:

    
    <?php
    $homepage = file_get_contents('http://www.example.com/myscript.php');
    echo $homepage;
    ?> 
    
    PHP:

    
    <?php
    
    try
    {
        include_once('HideUrlConfig.php');
    } 
    
    PHP:

    Which one of them I should use to hide the url without being printed out and also I could use to get the data and send the data to the scripts?
     
    mark103, Sep 20, 2010 IP
  6. ZachF

    ZachF Guest

    Messages:
    62
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    If it's on your hosting, you can do something like this:

    <?
    include "/home/public_html/user/folder/file.php";
    ?>
     
    ZachF, Sep 20, 2010 IP
  7. mark103

    mark103 Active Member

    Messages:
    110
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    53
    #7

    Thanks, I will use it. What about if I wish to get connect with another script on a different site while get and receive the data?

    Should I use something like this?

    <?php
    $homepage = file_get_contents('http://www.example.com/myscript.php');
    echo $homepage;
    ?> 
    PHP:
     
    mark103, Sep 20, 2010 IP
  8. mark103

    mark103 Active Member

    Messages:
    110
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    53
    #8
    bump....

    words too shorts
     
    mark103, Sep 21, 2010 IP
  9. mark103

    mark103 Active Member

    Messages:
    110
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    53
    #9
    please can someone give me an answer?
     
    mark103, Sep 22, 2010 IP
  10. riteshsanap

    riteshsanap Well-Known Member

    Messages:
    217
    Likes Received:
    2
    Best Answers:
    3
    Trophy Points:
    168
    #10
    Mark just use the include code that solves the problem and don't use echo statement as the codes or links are safe and not showing to users, they will be only showed when you give the echo statement so just three words dont use echo for that file :D
     
    riteshsanap, Sep 22, 2010 IP
  11. mark103

    mark103 Active Member

    Messages:
    110
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    53
    #11
    Thanks riteshsanap, so should I use both method while I get connect to the first script before come to the second one, while I hide the url??

    
    <?php
    
    try
    {
        include_once('HideUrlConfig.php');
    }
    
    PHP:
    
    <?php
    $homepage = file_get_contents('http://www.example.com/myscript.php');
    echo $homepage;
    ?>
    
    PHP:

    If you guess that I should use them, then I am going to use it. However, I have got a question: can I use both methods to post the data to pass on every php before it reaction to mysql database?


    Here it is an example if you dont get this...


    1. I connect to php script called myscript.php, then I send the text data from the program.
    2. While I connect to myscript.php, then it will pass the text data through to another script which it called HideUrlConfig.php.
    3. When the text data have pass on to HideUrlConfig.php, it will pass on to another scripts while the scripts details are in each php and can be pass on in every php before reaction to mysql database. I could also do the same for get method.


    If you get this, but if the php code I got would not post the data to pass on to every php scripts that I store in the php, then please post the source which would do the method so I would be much appreciate it.


    Thanks,
    Mark
     
    mark103, Sep 22, 2010 IP
  12. riteshsanap

    riteshsanap Well-Known Member

    Messages:
    217
    Likes Received:
    2
    Best Answers:
    3
    Trophy Points:
    168
    #12
    Ya you can use both one as both the links will not be visible to the visitors in source :D
     
    riteshsanap, Sep 23, 2010 IP
  13. mark103

    mark103 Active Member

    Messages:
    110
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    53
    #13
    thanks riteshsanap, so I am going to try them out. If I have any problem, I will post it back. Thanks for your help! :D
     
    mark103, Sep 23, 2010 IP