Jump to content


Search...and a little more!

  • Please log in to reply
1 reply to this topic

#1 mynameismud

  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 11 March 2006 - 05:38 PM

Hi all, been lurking for a while and tried some coding with limited success.

I'm looking to write some code that will display content (from an XML source) depending on whats in the URL/Address Bar. An example of this could be [a href=\"http://www.asite.com/fetch.php?=cars\" target=\"_blank\"]http://www.asite.com/fetch.php?=cars[/a]

Does this make any sense? Basically a searchbox on another page would send the user to a page with the url above, the page shown would pull XML source according to the bit following the '?'

Can anyone help, i've set up a phpBB board, but this is way beyond me. :(

#2 txmedic03

  • Members
  • PipPipPip
  • Advanced Member
  • 313 posts
  • LocationCall, TX, USA

Posted 13 March 2006 - 08:37 AM

if ( substr($_GET['srch'], strrpos($_GET['srch'], '.')+1) == "xml" ) {
  $source = implode('\r\n', file($_GET['srch']));
  if ( strlen($source) > 0 ) {
    echo $source;
  } else {
    echo "<p>No results to display.</p>\r\n";
} else {
  echo "<p>Can not return source for that type of file.</p>\r\n";

This assumes the name of the form field that contains the url is srch. This uses the file extension xml as the only possible source to return to keep people from being able to get source to php files and such which you may not want them to have.


I can't stop you from doing something silly, but at least I can help you do it right.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users