optikalefx Posted August 7, 2007 Share Posted August 7, 2007 so. ive got this complicated part of a php file. does some sql stuff, and some other stuff. basically i connect to the database, and run a query, then the while($row = mysql_fetch_array($sql)) all the way to the final echo are a remote file. that is because ill be using tha part on several pages, and just want to attach that script.. include doenst work. put doest work. and yes its over 2 diffrent domains, the file is on a different domain. any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/63681-include-files-and-use-them/ Share on other sites More sharing options...
ToonMariner Posted August 7, 2007 Share Posted August 7, 2007 some code would be great... Quote Link to comment https://forums.phpfreaks.com/topic/63681-include-files-and-use-them/#findComment-317419 Share on other sites More sharing options...
optikalefx Posted August 7, 2007 Author Share Posted August 7, 2007 this is the website code <html> <body bgcolor="white"> <?php $con = mysql_connect("xxxx","xxxx","xxxx"); mysql_select_db("update1", $con); $sql = mysql_query("SELECT value FROM JohnRobberts WHERE fname='service'"); include 'http://www.4tenproductions.com/pagegen.php'; ?> </body></html> and i want this is pagegen that i want to be used right after the sql statement: while($row = mysql_fetch_array($sql)) { $string = $row['value']; } //create tag heading $patterns[0] = '/<heading>/'; $patterns[1] = '/<end heading>/'; $replacements[1] = '<span id=head>'; $replacements[0] = '</span>'; $string = preg_replace($patterns, $replacements, $string); function getImage($img) { $query = "SELECT pic FROM pics WHERE num ='$img'"; $result = mysql_query($query); if(mysql_num_rows($result) == 1) { $row = mysql_fetch_assoc($result); return '<img src="http://www.4tenproductions.com/ir/uploadedfiles2/' . $row['pic'] . '">'; } } $final = preg_replace('/<include picture# ([0-9]+)>/ise', "getImage($1)", $string); echo $final; basically im using that pagegen.php over and over again,the only thing thats chainging is the query thats run. but include ''; wont work Quote Link to comment https://forums.phpfreaks.com/topic/63681-include-files-and-use-them/#findComment-317751 Share on other sites More sharing options...
ToonMariner Posted August 7, 2007 Share Posted August 7, 2007 are the servers set up to not allow includes to or from other domains??? Quote Link to comment https://forums.phpfreaks.com/topic/63681-include-files-and-use-them/#findComment-317988 Share on other sites More sharing options...
optikalefx Posted August 7, 2007 Author Share Posted August 7, 2007 how would i know/ find that information? Quote Link to comment https://forums.phpfreaks.com/topic/63681-include-files-and-use-them/#findComment-317990 Share on other sites More sharing options...
ToonMariner Posted August 7, 2007 Share Posted August 7, 2007 well if your code is correct, the paths are correct, you have checked that no errrors occur by setting error_reporting on and its still don't work then that would be a very good indicator.... Quote Link to comment https://forums.phpfreaks.com/topic/63681-include-files-and-use-them/#findComment-317996 Share on other sites More sharing options...
optikalefx Posted August 8, 2007 Author Share Posted August 8, 2007 well this works fine include 'http://www.promptservicemd.com/pagegen.php'; but this doesnt include 'http://www.4tenproductions.com/pagegen.php'; and the same file is on both servers. the file that is requsting the include is on promptservicemd Quote Link to comment https://forums.phpfreaks.com/topic/63681-include-files-and-use-them/#findComment-317999 Share on other sites More sharing options...
ToonMariner Posted August 8, 2007 Share Posted August 8, 2007 they may be on the same servers that does not mean to say the configuration for each domain is identical... Quote Link to comment https://forums.phpfreaks.com/topic/63681-include-files-and-use-them/#findComment-318001 Share on other sites More sharing options...
teng84 Posted August 8, 2007 Share Posted August 8, 2007 i dont think you can use include in the different root directory mybe you will need curl but it only get the html and include on the page Quote Link to comment https://forums.phpfreaks.com/topic/63681-include-files-and-use-them/#findComment-318017 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.