receiver Posted June 6, 2010 Share Posted June 6, 2010 Hello! I need an alternative to <script type='text/javascript' src='http://www.domeen.com/mydisplay.php'></script> (this displays the site mydisplay.php on other domains) I know its possible to do with php. I just need that the mydisplay.php(from my domain) is displayed on the other domain as its own real page content, this means whatever the mydisplay shows its no different from other domains content.... if there is better way let me pllsss know;) the purpose is to display backlinks that works with search engines. Thank you! Quote Link to comment https://forums.phpfreaks.com/topic/204047-php-can-do-anythingo/ Share on other sites More sharing options...
sspoke Posted June 6, 2010 Share Posted June 6, 2010 include('mydisplay.php'); or include('http://www.domeen.com/mydisplay.php'); Quote Link to comment https://forums.phpfreaks.com/topic/204047-php-can-do-anythingo/#findComment-1068770 Share on other sites More sharing options...
5kyy8lu3 Posted June 7, 2010 Share Posted June 7, 2010 I personally use: echo $PageContents = filegetcontents("http://www.thesite.com/thepage.php"); since the server parses the php, it just returns the html, which you can save into a variable or echo or whatever you wish Quote Link to comment https://forums.phpfreaks.com/topic/204047-php-can-do-anythingo/#findComment-1068802 Share on other sites More sharing options...
receiver Posted June 7, 2010 Author Share Posted June 7, 2010 oh! i couldn't believe that it is that easy, thank you! . but it works only on .php pages not on html or any others right. is there any other way! thank you! Quote Link to comment https://forums.phpfreaks.com/topic/204047-php-can-do-anythingo/#findComment-1068930 Share on other sites More sharing options...
Alex Posted June 7, 2010 Share Posted June 7, 2010 @5kyy8lu3, the function is file_get_contents, and because you're including a remote file in this case it doesn't matter whether you use include or file_get_contents, you'll only get the output of the file regardless. @receiver, any file can be included. Quote Link to comment https://forums.phpfreaks.com/topic/204047-php-can-do-anythingo/#findComment-1068932 Share on other sites More sharing options...
receiver Posted June 7, 2010 Author Share Posted June 7, 2010 @receiver, any file can be included. i mean that example this code "include('http//mypage.com/thisdokument.php')" works only if u place it in php document not html. (html doesnt display php codes) right? Quote Link to comment https://forums.phpfreaks.com/topic/204047-php-can-do-anythingo/#findComment-1068933 Share on other sites More sharing options...
Alex Posted June 7, 2010 Share Posted June 7, 2010 Oh then yes, that needs to be executed by PHP to work, obviously. There are ways to make the server parse .html files as PHP files though. Quote Link to comment https://forums.phpfreaks.com/topic/204047-php-can-do-anythingo/#findComment-1068934 Share on other sites More sharing options...
ignace Posted June 7, 2010 Share Posted June 7, 2010 echo $PageContents = filegetcontents("http://www.thesite.com/thepage.php"); Returns the content as-is which means that if you output it the PHP code will be visible in the HTML source. It obviously needs to be include('http://www.thesite.com/thepage.php'); (with allow_url_fopen, PHP is parsed on the server) or better yet include('thepage.php"); (PHP is parsed on your server) which will parse the PHP. Quote Link to comment https://forums.phpfreaks.com/topic/204047-php-can-do-anythingo/#findComment-1068938 Share on other sites More sharing options...
trq Posted June 7, 2010 Share Posted June 7, 2010 echo $PageContents = filegetcontents("http://www.thesite.com/thepage.php"); Returns the content as-is which means that if you output it the PHP code will be visible in the HTML source. No it won't. It will return the output produced by the php being parsed on the server because you are requesting the file via http. If it where a local file requested via the file system you would get the php source. Quote Link to comment https://forums.phpfreaks.com/topic/204047-php-can-do-anythingo/#findComment-1068944 Share on other sites More sharing options...
ignace Posted June 7, 2010 Share Posted June 7, 2010 No it won't. Ah yes, I missed the http:// part. I was a bit confused by AlexWD's post. Quote Link to comment https://forums.phpfreaks.com/topic/204047-php-can-do-anythingo/#findComment-1068947 Share on other sites More sharing options...
receiver Posted June 7, 2010 Author Share Posted June 7, 2010 ok i can use 2 methods: <?php $PageContents = file_get_contents("http://www.site.com/page.php"); echo("$PageContents"); ?> <?php include('http://www.site.com/page.php'); ?> they work nicely in php document. thank you now what i need is to get these codes to work in html and all other page types: I can create .htaccess <Files page.html> AddType application/x-httpd-php .html </Files> so this .htaccess makes it to work in html. (this does not work for me because i need simple code that works anywhere) just by copy paste. Is there any other way? Thank you! Quote Link to comment https://forums.phpfreaks.com/topic/204047-php-can-do-anythingo/#findComment-1069014 Share on other sites More sharing options...
Alex Posted June 7, 2010 Share Posted June 7, 2010 No, you either need to use a file with a .php extension or use that method to allow .html to be parsed as a PHP document, AFAIK there is no other way. Quote Link to comment https://forums.phpfreaks.com/topic/204047-php-can-do-anythingo/#findComment-1069018 Share on other sites More sharing options...
receiver Posted June 7, 2010 Author Share Posted June 7, 2010 ok! can't do the easy way. but php and html are the most used right? whats the 3-d most used page type? and btw you cant show this code on platforms like blogger etc or can you include the .htaccess document or command and will it work? thank you! Quote Link to comment https://forums.phpfreaks.com/topic/204047-php-can-do-anythingo/#findComment-1069050 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.