/    Sign up×
Community /Pin to ProfileBookmark

code that pulls another sites page and places it on php page

like a template i guess, i am looking for this code that i place in php that will grab another webpage and show it on the page.

example.

site 1 and site 2

site 1 is my main page, and i have all this data on the page, then below i want to have the php page pull up site 2 so users can view whatever is in that site.

how do i do this?

to post a comment
PHP

12 Comments(s)

Copy linkTweet thisAlerts:
@LiLcRaZyFuZzYOct 09.2005 — from the php manual

If "URL fopen wrappers" are enabled in PHP (which they are in the default configuration), you can specify the file to be included using a URL (via HTTP or other supported wrapper - see Appendix J for a list of protocols) instead of a local pathname. If the target server interprets the target file as PHP code, variables may be passed to the included file using a URL request string as used with HTTP GET. This is not strictly speaking the same thing as including the file and having it inherit the parent file's variable scope; the script is actually being run on the remote server and the result is then being included into the local script.
[/QUOTE]

so basically, if your servers php settings allow it, you can have the include function include a file through an url
Copy linkTweet thisAlerts:
@GoTTiauthorOct 10.2005 — can u point me to that info and code that i would use to do this?
Copy linkTweet thisAlerts:
@NogDogOct 10.2005 — Simply including another HTML page within your HTML page will result in invalid HTML markup (mutliple HTML, HEAD, and BODY tags, for instance). I'd probably use an IFRAME instead: http://www.w3.org/TR/html4/present/frames.html#h-16.5
Copy linkTweet thisAlerts:
@LiLcRaZyFuZzYOct 10.2005 — the w3c recommends no html,head and body tags for frames as well, so both way would result in in invalid markup wouldn't it
Copy linkTweet thisAlerts:
@NogDogOct 10.2005 — the w3c recommends no html,head and body tags for frames as well, so both way would result in in invalid markup wouldn't it[/QUOTE]
I'm not aware of any such restriction for iframe contents, though I'm not aware of a lot of such things. ?

All I know is that this works as I intend, having the page display within my page...
[code=html]
<h2>This is an iframe:</h2>
<iframe src="http://www.bluerobot.com/web/layouts/">
Oops! IFRAME did not display
</iframe>
[/code]

Whereas if I do the following, in FF the included page's style overwrites my style and messes things up, while my style overwrites its style in IE.
[code=php]
<h2>This is a include:</h2>
<?php include("http://www.bluerobot.com/web/layouts/"); ?>
[/code]

So, even if it's not "recommended" by W3C, I'd still choose the iframe over a PHP include in this situation.
Copy linkTweet thisAlerts:
@LiLcRaZyFuZzYOct 10.2005 — 

as would i
--


for my previous post: i really might be wrong, i dont remember were i read this. So if anyone could tell me, id be glad
Copy linkTweet thisAlerts:
@GoTTiauthorOct 10.2005 — here is my dilema.

google adsense is blocked on my site because of content. which is stupid because the content isnt as bad as they would like it to be. anyways, i would like to put google adsense on my site still, and my friend has adsense, and when i put his code on my site it just comes up blank. so the idea is to call the adsense from his site through mine and have the banners still show in like a frame....

can this be done?

when i do it with the frame, its coming up a blank page still.
Copy linkTweet thisAlerts:
@LiLcRaZyFuZzYOct 10.2005 — why is it blocked anyway?

is it free hosting?
Copy linkTweet thisAlerts:
@felgallOct 10.2005 — Adsense only works when it is on the actual page because Google needs to see what the page actually contains to work out what ads to include.
Copy linkTweet thisAlerts:
@GoTTiauthorOct 10.2005 — because of the content adsense is blocked on my site.
Copy linkTweet thisAlerts:
@GrepZenDec 25.2006 — so the idea is to call the adsense from his site through mine and have the banners still show in like a frame....[/QUOTE]

google's adsense content isn't on your site. It never was. IIRC: you link to it.

To get that content on your 3rd party page, you'd have to actually pull the page and parse it. PHP's CURL may be of intrest in that regard.

Begs the question though....when users click on your 'copy' of your friend's google ads.... who gets the penny?

V/R -- Micke
×

Success!

Help @GoTTi spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.14,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...