Hi there, I feel like a bit of a chop (colloquial expression for an idiot) because I really should know this... I do web development for clients and on certain client sites I want to be able to include a line of text. BUT, I may want to change that line from time to time, so what I want to do is put a file on MY server with the line, and then include this file on THEIR server. SO, On MY server, a file called clienttext.inc <? $TextLine = "This must show on the client site"; ?> and on THEIR server: <? // other stuff include("http://www.softsmart.co.za/path/clienttext.inc"); print $TextLine; ?> But, it doesn't seem to work. Please help Thanks, John
Have you tryin switch to file_get_content ? maybe it disabled on your host? <? $textinc = file_get_contents("http://www.softsmart.co.za/path/clienttext.inc"); echo ($textinc); ?> PHP:
To communicate between different websites you can use different methods. If Website A has the line of text and Website B wants to use it. The normal way should be that Website A just echo's the line text. And Website B gets the line text with file_get_contents() - as kecoa-ngamuk did. If you have more than just one text line, you should use XML or JSON. However the method of loading an external PHP file, then load it as PHP with eval() and then using the variables is not very common nor good.
Nice job being condescending (=arrogant and patronizing) by explaining to us what that word means, but the word you're looking for is actually "chump" not "chop".
Umm... No, its chop. That's why I said colloquial (meaning colloquial in my country). Nice try though.
Thanks for the posts everyone. I got things to work on some servers and not others. As I don't have access (besides FTP), I decided to use CURL to read in the file I was after. Thanks... John
you cant include fiile from out server like that include("http://www.softsmart.co.za/path/clienttext.inc"); use curl