October 31, 201213 yr Hey guys, I'm stuck. I'm building a small site / app .... The app MUST run on https:// which is set up on my servers ... now the problem is, the app needs to pull an external javascript file from a completely different server which I am unable to make any changes to, so I can't install SSL on there.... so everything on this second server is always http only. Is it possible using PHP or Javascript to get the contents of the file ... and then output it via a new file or directly within the document, thus making it secure using my own SSL ?
October 31, 201213 yr Hi, is there a good reason why you cant have the javascript file on your server or try this you can work around it <?php $file = file_get_contents('http://www.example.com/js/required-file.js'); echo $file; ?> I think this will still give you a problem with SSL Edited October 31, 201213 yr by ELITE
October 31, 201213 yr Author Hi Elite, the main issue is this website/app has variables based on a userID variable passed via the URL ... so for example I may need to pull http://domainname.com/userID/1234/jsfile.js or next time http://differentdomainname.com/userID/5487/jsfile.js ... Esentially the files are almost identical, however in some of them there may be slight differences based on their account type. I had a feeling the "file_get_contents" might be the way to go.... thanks for confirming my suspicions (sort of) ... I'll give it a try and see what happens! Fingers crossed... otherwise I need to try and persuade the server owner to SSL every domain name! (There are 600 domains urghhhhhhhhh) Ohhh that could be costly! LOL LOL
October 31, 201213 yr I have just tried it on a site with an SSL and it is working with file_get_contents Edited October 31, 201213 yr by ELITE
Create an account or sign in to comment