Welcome Guest, Not a member yet? Register   Sign In
file_get_contents then perform javascript. possible?
#1

[eluser]new_igniter[/eluser]
Hello,
I am trying to get HTML from a page on another domain, then perform javascript to get an image...not the physical image, but the img src. Below is what I have so far, and it alerts [object HTML Image Element]. Is there a way for me to access the src through that object? Part B of my question, how can I make the HTML available to the javascript without printing it on the screen?

Code:
<?php
$url = 'http://twitpic.com/hmgt';
$xmldata = file_get_contents($url);
echo $xmldata;
?>
[removed]
elem = document.getElementById("pic");
alert(elem);
[removed]

Thanks!!!
#2

[eluser]GSV Sleeper Service[/eluser]
Code:
alert(elem.src);
should do the trick. I recommend you install 'firebug' then you can use
Code:
console.log(elem.src);
the trouble with using alert() is sooner or later you'll end up alerting() in an infinite loop, which is never fun.
I don't understand part B of your question.
#3

[eluser]new_igniter[/eluser]
Thanks GSV, works great.




Theme © iAndrew 2016 - Forum software by © MyBB