Home
Saturday, June 24, 2017
8:36:21 PM
Users online: 0   You are here >> Home > Web Design

Forums | Web Design Forums search
Forum FAQ
   
  1  
[Help] Text from 1 site into another?
cyb3rspy 
28/5/08 12:33:57 PM
Guru

Hi guys, ok what I need to do (and I been up for 24 hours on others work so brain is fried today) there's a web site that has info I need that does change, the info/webpage is displayed rather a lot like notepad (white BG, black text, Zero formatting). what i am needing to to is insert or extract that info and put it onto my page.

I'm sure it can be done and without to much fuss but lacking grey matter to do it, thx in advance.


Cybs :-)

-----
http://www.cyb3rspy.is.dreaming.org
Yeah I play WoW...Yeah I know I got no life, But I got these 2 awesome lvl 70 characters. Rogue & Priest (Aman'Thul Server)
Got A problem? -> Build A Bridge & Get Over It

Sneddo 
28/5/08 4:48:14 PM
Hero
Immortal


You could use an iframe, server-side language or AJAX to do it.


Edited by Sneddo: 28/5/2008 04:48:31 PM

-----

superfireydave 
28/5/08 6:20:42 PM
Titan

Yeah, if it's already marked up correctly for you, iFrames would be one solution. If not, it's a tad more difficult.

-----
Mreow?
http://www.atomicmpc.com.au/forums.asp?s=2&c=9&t=17306

johnsee 
28/5/08 6:23:24 PM
Mod
SuperHero

Immortal


Can you link us to the page?

If it is purely text and no html code, you can just include it

<?php include(' http://www.domain.com/page.html');?>

-----
Quote by Mac Dude
I love the smell of napalm in the Green Room.
------

cyb3rspy 
28/5/08 8:42:12 PM
Guru

this is where I get flamed down, ok this it the page Johnsee:
http://launcher.worldofwarcraft.com/alert

-----
http://www.cyb3rspy.is.dreaming.org
Yeah I play WoW...Yeah I know I got no life, But I got these 2 awesome lvl 70 characters. Rogue & Priest (Aman'Thul Server)
Got A problem? -> Build A Bridge & Get Over It

luser 
28/5/08 8:45:39 PM
Overlord

Quote by johnsee
Can you link us to the page?

If it is purely text and no html code, you can just include it

<?php include(' http://www.domain.com/page.html');?>



According to http://au2.php.net/include/ that will evaluate ' http://www.domain.com/page.html' and attempt to execute it as PHP. Which means that if the person running www.domain.com found out you were doing that, they could replace it with whatever PHP code they wanted, and you would blindly run it.

You must be joking. Anyone stupid enough to run scripts from a server they don't control is asking for pain. And why the hell would you attempt to evaluate as code a page that you expect to contain text/html only?

Sorry to be so harsh but I just can't believe anyone would make such an irresponsible suggestion.

-----
It's gonna be a glorious day!
I feel my luck could change.

superfireydave 
28/5/08 9:09:17 PM
Titan

Quote by cyb3rspy
this is where I get flamed down, ok this it the page Johnsee:
http://launcher.worldofwarcraft.com/alert


There's nothing on that page tho, or am I missing something?

-----
Mreow?
http://www.atomicmpc.com.au/forums.asp?s=2&c=9&t=17306

cyb3rspy 
28/5/08 9:19:54 PM
Guru

atm it's blank but when there is an event it's just put there as plan text

-----
http://www.cyb3rspy.is.dreaming.org
Yeah I play WoW...Yeah I know I got no life, But I got these 2 awesome lvl 70 characters. Rogue & Priest (Aman'Thul Server)
Got A problem? -> Build A Bridge & Get Over It

superfireydave 
28/5/08 9:59:42 PM
Titan

Just as plain text?
Or is it plain text wrapped in xhtml?

-----
Mreow?
http://www.atomicmpc.com.au/forums.asp?s=2&c=9&t=17306

Sneddo 
29/5/08 9:04:08 AM
Hero
Immortal


Quote by luser
According to http://au2.php.net/include/ that will evaluate ' http://www.domain.com/page.html' and attempt to execute it as PHP.

No, it won't. It will run the script on the remote server and include the result. Think about it, if include worked this way every PHP site's source would be completely open, which would be a very bad thing.

-----

luser 
29/5/08 12:40:09 PM
Overlord

Quote by Sneddo
Quote by luser
According to http://au2.php.net/include/ that will evaluate ' http://www.domain.com/page.html' and attempt to execute it as PHP.

No, it won't. It will run the script on the remote server and include the result.



Yeah, that's what I'm saying. If the result is valid PHP it will be executed locally.

-----
It's gonna be a glorious day!
I feel my luck could change.

johnsee 
29/5/08 5:33:14 PM
Mod
SuperHero

Immortal


If the remote site has PHP code in a text file, then yes, it would run as PHP on the local server.

If the remove server has the PHP code in a PHP file, then no, the code would run on the remote server.

Now personally, I really can't see blizzard putting PHP code in that page. As long as you trust your source, it's not a problem. In this case I would say the source is trustworthy enough for a non-commerical site (like this would appear to be).

The include could also easily include a function to strip out tags or PHP code.

-----
Quote by Mac Dude
I love the smell of napalm in the Green Room.
------

luser 
29/5/08 6:19:04 PM
Overlord

Quote by johnsee
If the remote site has PHP code in a text file, then yes, it would run as PHP on the local server.

If the remove server has the PHP code in a PHP file, then no, the code would run on the remote server.


That's up to the web server, but it's irrelevant anyway. All that matters is what the server ends up sending you.

Quote by johnsee
Now personally, I really can't see blizzard putting PHP code in that page. As long as you trust your source, it's not a problem. In this case I would say the source is trustworthy enough for a non-commerical site (like this would appear to be).


Why would you want to even introduce the possibility of running code from a remote server locally? The impact of that means the risk is too high IMO.

If you had to use PHP I think the best way would be to use a PHP HTTP client. Luckily someone's already written one and it only takes a few lines to do this: http://scripts.incutio.com/httpclient/examples.php

 
$client = new HttpClient(' http://launcher.worldofwarcraft.com');
if (!$client->get('/alert')) {
die('An error occurred: '.$client->getError());
}
$pageContents = $client->getContent();

Then I guess just print out $pageContents wherever you need it.

-----
It's gonna be a glorious day!
I feel my luck could change.

Sneddo 
29/5/08 6:58:12 PM
Hero
Immortal


Quote by luser
Quote by Sneddo
Quote by luser
According to http://au2.php.net/include/ that will evaluate ' http://www.domain.com/page.html' and attempt to execute it as PHP.

No, it won't. It will run the script on the remote server and include the result.



Yeah, that's what I'm saying. If the result is valid PHP it will be executed locally.

Ahh good point, I hadn't thought of it like that. Been away from PHP for a good (and I mean good!) 18 months now.

-----

cyb3rspy 
29/5/08 8:59:41 PM
Guru

ok i think I'll just stick to iframe, to see this in action head to www.EliteX.owns.it and look at the bottom left of screen. it's just a small page and i don't think it needs all the bells and whistles.

thx again guys for ur valued help.


cybs

-----
http://www.cyb3rspy.is.dreaming.org
Yeah I play WoW...Yeah I know I got no life, But I got these 2 awesome lvl 70 characters. Rogue & Priest (Aman'Thul Server)
Got A problem? -> Build A Bridge & Get Over It

nicephotog-jvm.net 
9/6/08 8:29:44 PM
Master

regular expressions
test parameters

-----
NIN - Reptile (Reciprocating Marine engine)

  1  
Forums | Web Design