Hello friends! Maybe someone can help me I've hosting A and hosting B.. , I'm trying to include in hosting A a remote file of of hosting B but really I cannot, I have tried include ("http://url.com/file.php), but as I read this is not possible, also I have treid with fopen but the file in B have <? ?> and values, and I need to read the values of B in A. Anyone here know how to do it? Best and thanks for the time, Jakomo
you can write a seperate php program which outputs the values of file.php from site B and then fopen read those content to your current php file Regards Alex
Hello, This is a good idea, but I need to get get connection values, I dont like to get the connection values (password, hosting, username) in the server A. Thanks, Jakomo
It's a very bad idea. Including an external php file means that file will not be processed by the server and thus the content can be read. If you have to do it, simply rename the .php file to a different extension so that the other server does not process it (remember, php is server-side).
Hello, thanks! If I reneneme the file, it will show the information as data in the browser Best, Jakomo
Isn't that what you wanted? when you say include in php, it means include php code, so it is unprocessed code. what did you want exactly?
Hello, Yes, sound wrong.. , sorry This is what I have: Hosting A FILE: test.php <? //include_once("http://www.hostingB.com/conexion.php"); <<---- NO RUN, I hope if ($fp = fopen('http://www.hostingB.com/conexion.php', 'r')) { $content = ''; // keep reading until there's nothing left while ($line = fread($fp, 1024)) { $content .= $line; } } eval('?>' .$content. '<?php '); $sql="SELECT * FROM table"; $result = mysql_query($sql,$conexion); //$conexion come from B if (mysql_num_rows($result)>0) { $row = mysql_fetch_assoc($result); } echo ucfirst($row['title']); ?> Hosting B FILE: conexion.php <? $conexion = @mysql_connect("IPORT","username","password") or die("ERROR: Could not connect to database!"); $connect=mysql_select_db("db",$conexion); ?>
hey you just need to specify the DB security restictions of site A put the IP of site B . And then you can access the db of site A from site B This is what you want i guess Regards Alex