Page 1 of 1
How can I get url content to variable?
Posted: Mon Sep 18, 2006 11:42 am
by nadavvin
Hello
I want to get html content from other URL to variable.
I know that with XML I can use in domxml but It's not xml and I want to get it as string.
How do I do this?
Posted: Mon Sep 18, 2006 11:52 am
by Luke
fopen() or maybe file_get_contents() (php5)
Posted: Mon Sep 18, 2006 1:42 pm
by akimm
Why exactly do you ask, I am confused as to what you exactly want to do.
Posted: Mon Sep 18, 2006 1:46 pm
by Luke
he wants to get the content from another url into a variable...
Code: Select all
// Loads contents of site into a variable
$contents_of_devnet = file_get_contents('http://www.forums.devnetwork.net');
Posted: Mon Sep 18, 2006 1:56 pm
by akimm
Thats neat lol. Altho it scares me if it works, because of how easily content can be stolen

Posted: Mon Sep 18, 2006 1:56 pm
by nadavvin
yes, It's what I want.
There is a forum which I like but there isn't any RSS with it.
I want to get the forum page and make it RSS.
Thanks for your help.
nadav
Posted: Mon Sep 18, 2006 1:57 pm
by Luke
It's no different than clicking "view source" except it is being done by php instead of your mouse... nothing really to worry about.
Posted: Mon Sep 18, 2006 2:15 pm
by John Cartwright
The Ninja Space Goat wrote:file_get_contents() (php5)
fyi, file_get_contents() is php4, file_put_contents() is php5
Posted: Mon Sep 18, 2006 2:16 pm
by Luke
oh wow... didn't know that.. thanks jcart!

Posted: Mon Sep 18, 2006 3:01 pm
by feyd
nadavvin wrote:yes, It's what I want.
There is a forum which I like but there isn't any RSS with it.
I want to get the forum page and make it RSS.
Thanks for your help.
nadav
Have you asked them about adding an RSS feed from it?
Posted: Mon Sep 18, 2006 3:11 pm
by nadavvin
I think that I send them request to add RSS and they didn't return any answer.