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
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?
Yes, I mean to hide the url from outside users. Is it possible to store the url secure similar as config??
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.
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?
If it's on your hosting, you can do something like this: <? include "/home/public_html/user/folder/file.php"; ?>
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:
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
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
thanks riteshsanap, so I am going to try them out. If I have any problem, I will post it back. Thanks for your help!