Jump to content

Taking Javascript output and outputting using PHP


s0crates9

Recommended Posts

Is there a way to take a newsgator javascript link or something similar and use the output in PHP so that the links from an RSS feed are in HTML?

 

Right now for example, Newsgator gives users for blogs a line like:

<script src="http://services.newsgator.com/ngws/headlines.aspx?uid=XXXXXX&mid=XX"></script>

 

I want to use PHP to post the results into HTML like:

<a href="http://www.blah.com/news/story1.html">Story of the hour!</a><br />

<a href="http://www.blah.com/news/story2.html">Story Number 2</a><br />

ETC...

 

Any help with this would be much appreciated!

 

  • 2 weeks later...

Not sure how will the newsgator output the HTML, but if the script prints out HTML code, you can load the output into a div, and fill a form field with the div innerHTML and submit the form to a php file.

 

<html>
<head>
<script language="javascript">
function submit_form(){
	document.getElementById('html_output').value = document.getElementById('HTML_code').innerHTML;
	document.getElementById('html_form').submit();
}
</script>
</head>
<body onload="submit_form();">
<div id="HTML_code">
<script src="http://services.newsgator.com/ngws/headlines.aspx?uid=XXXXXX&mid=XX"></script>
</div>

<form method="post" action="SOME_PAGE.php" id="html_form" name="html_form">
<input type="hidden" name="html_output" id="html_output" />
</form>
</body>
</html>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.