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!

 

Link to comment
Share on other sites

  • 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>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.