hno Posted September 27, 2009 Share Posted September 27, 2009 HI How can read a web site content without using curl and displaying all content of a site in my page? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/175703-how-to-read-a-web-site/ Share on other sites More sharing options...
Alex Posted September 27, 2009 Share Posted September 27, 2009 You can use file_get_contents() $content = file_get_contents('http://phpfreaks.com'); echo $content; Quote Link to comment https://forums.phpfreaks.com/topic/175703-how-to-read-a-web-site/#findComment-925885 Share on other sites More sharing options...
halwaraj Posted September 27, 2009 Share Posted September 27, 2009 I guess you can use Ifame with source as pointing to the site you want to point to. Not sure though. Quote Link to comment https://forums.phpfreaks.com/topic/175703-how-to-read-a-web-site/#findComment-925946 Share on other sites More sharing options...
.josh Posted September 27, 2009 Share Posted September 27, 2009 You can use file_get_contents() $content = file_get_contents('http://phpfreaks.com'); echo $content; Only works if fopen_wrappers is enabled though. Quote Link to comment https://forums.phpfreaks.com/topic/175703-how-to-read-a-web-site/#findComment-926060 Share on other sites More sharing options...
KFredje Posted September 27, 2009 Share Posted September 27, 2009 I'm doing it like this: put this in your head according to your site: <?php switch($_GET['pagina']) { case "inhoud": $page="BEinhoud.html";break; case "logboek": $page="BElogboek.html";break; case "profielen": $page="BEprofielen.html";break; case "kalender": $page="BEkalender.html";break; case "gastenboek": $page="guestbook/list.php?page=1&order=asc";break; default: $page="BEhome.html";break; } ?> links like this (already in body): <a href="?pagina=profielen"></a> and then this in body where you wanne let the content load: <?php include $page; ?> In your pages you wanne load in another you have to delete everything exept your stuff what is in body. switch($_GET['pagina']) { -> you can change the word "pagina" (without "") to anything you like but do it then also in your links. Quote Link to comment https://forums.phpfreaks.com/topic/175703-how-to-read-a-web-site/#findComment-926065 Share on other sites More sharing options...
hno Posted September 28, 2009 Author Share Posted September 28, 2009 You can use file_get_contents() $content = file_get_contents('http://phpfreaks.com'); echo $content; HI Thanks for your replies I think You get wrong my request. I have a site that name is :www.wxample.com Now I want example.example2.com display the content of www.example.com.How can I do that without curls? alexdw suggestion doesn't work for me and kfredje suggestion ,could you explain it more plese Thanks all Quote Link to comment https://forums.phpfreaks.com/topic/175703-how-to-read-a-web-site/#findComment-926212 Share on other sites More sharing options...
KFredje Posted September 28, 2009 Share Posted September 28, 2009 well, make a file index.php or whatever name you want and a file what you want to load in index.php, something like home.html past in index.php the following stuff: <html> <head> <?php switch($_GET['example1']) { case "inhoud": $page="content.html";break; default: $page="home.html";break; } ?> </head> <body> <div id="nav"> <a href="?example1=home"></a> <a href="?example1=inhoud"></a> </div> <div id="in this div your pages get loaded"> <?php include $page; ?> </div> </body> </html> K, now I'll explain ya each part. <head> <?php switch($_GET['page']) { case "inhoud": $page="content.html";break; default: $page="home.html";break; } ?> </head> as you see, here are the links defined. the word "example1" in switch($_GET['page']) { can be given any name you want, just make sure you give the same name to the links in the body. the worth after case can also be changed in anything you like, here it's "inhoud". Also your default page you want to load have to be set, here it's home.html. This page will be loaded when you load your site. <div id="nav"> <a href="?example1=home"></a> <a href="?example1=inhoud"></a> </div> here are the links you've set in the header. I guess you will figure out how to use it. <div id="in this div your pages get loaded"> <?php include $page; ?> </div> and here is your page loaded in. just past it on the right place and don't change it. Hope you understand. example1 isn't used from your previous post, just that you know. If you have more questions, just ask ^^ Quote Link to comment https://forums.phpfreaks.com/topic/175703-how-to-read-a-web-site/#findComment-926481 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.