aleX_hill Posted July 26, 2010 Share Posted July 26, 2010 Ok, here is the situation. I have a few sites which all use the same functions (while connected to different dbs) to display content. Instead of updating each site when there is a change, I want to include all the display functions in one file, hosted on a different domain, and include that file on each site. So, being on shared hosting, allow_url_fopen isnt an option. I havent used CURL before, but I tried the code below, but that doesnt work either: $curl_handle=curl_init(); curl_setopt($curl_handle,CURLOPT_URL,'http://myurl.com/functions/siteFunctions1.0.php'); curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,10); curl_exec($curl_handle); curl_close($curl_handle); Is CURL an option for this, or is there another way that I can go about it? Cheers, Alex Quote Link to comment Share on other sites More sharing options...
trq Posted July 26, 2010 Share Posted July 26, 2010 There is no way of doing this without placing the files in question within a specific drive and network mounting it. Making a request for the file via http will simply have the remote server execute the php and send you the resulting output. Quote Link to comment Share on other sites More sharing options...
aleX_hill Posted July 26, 2010 Author Share Posted July 26, 2010 Well doesnt that suck. I wont be able to mount drives being on a hosted server. Looks like I am stuck with editing 10 files each time I make a small change Unless I write a cron to periodically replace the PHP files with the content from the "master" PHP file... now there is an idea Quote Link to comment Share on other sites More sharing options...
trq Posted July 26, 2010 Share Posted July 26, 2010 A better option would be to automate your build process. Assuming your using a version control system (which you should be) it wouldn't be too difficult to ftp or scp your files to each server when there is a commit. Quote Link to comment Share on other sites More sharing options...
aleX_hill Posted July 26, 2010 Author Share Posted July 26, 2010 I dont use a version control system, I just upload the files from dreamweaver. Much of the time there are edits to the other files on the website, ie the actual page structure, css files etc, the only similar file is the one holding the functions. Can you suggest a decent (preferably freeware) version control system for Windows? Quote Link to comment Share on other sites More sharing options...
trq Posted July 26, 2010 Share Posted July 26, 2010 I use subversion. http://subversion.apache.org Quote Link to comment Share on other sites More sharing options...
aleX_hill Posted July 26, 2010 Author Share Posted July 26, 2010 The listed programs all seem a bit over my head there. They have too much functionality for what I need and its confusing me. Quote Link to comment Share on other sites More sharing options...
aleX_hill Posted July 27, 2010 Author Share Posted July 27, 2010 Oh the simpleness of my answer is killing me. Was obviously too late last night... The two domains are on the same server, so I just needed to use a variation of include with a $_SERVER['DOCUMENT_ROOT'] call to include the file. Quote Link to comment 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.