Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Computer Forums > Programmers Lounge > Programming Discussions » Java/ HTML post - GET, shows space as +
Closed Thread
Old 01-20-2007, 11:59 PM   #1 (permalink)
 
True Techie

Join Date: Feb 2006

Posts: 207

poorman

Default Java/ HTML post - GET, shows space as +

I have put together this script:

PHP Code:
<html>
<head>
<title>Auto Updater: Shoutcast Title</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="refresh" content="5">
</head>
<body BGColor=#FFFFFF Text=#000000 link="blue" vlink="blue"><font face="arial,helvetica" size=-1>
<script type="text/javascript" language="JavaScript">
window.onload = function (){window.onload={};document.title.submit();} 
</script>

</font><font face="Arial" size=-1>
Shoutcast auto title updater.</font>

<font face="Arial" size="-1">By Brett P. </font></p>
<font face="arial,helvetica" size=-1>




<form action="http://2**.69.181.171:****/admin.cgi?" ENCTYPE="multipart/form-data" method="GET"  name="title" target="I1"><font face="arial, helvetica" size=-1>[b]

<input type="hidden" name="pass" value="*****">

<input type="hidden" name="mode" value="updinfo">

    Current Track:
    <input type="text" name="song" value="<?php include("../XMLSongs.php"); ?>" size="57">
    <input type="submit" value=" Manual Update Title">

</font>[/b]</form>

[b]* Title information will automatically gather and update every 30 seconds.[/b]</font>


<iframe name="I1" src="spitout.php" border="0" frameborder="0" width="610" height="1">
Your browser does not support inline frames or is currently configured not to display inline frames.
</iframe></p>
</body>
</html>

It's job is to basicly gather data from a plain text file (xmlsongs.php), and submit it to the server. It is a shoutcast server and this tool is used to update the Song playing field. It works good except for every space it displays it as a +. I understand this has to do with encoding. I need to replace each space with instead. Not %20.

I tried many things, I got close with being able to change any spaces with the subsitution of my choice () . But I do not know how to make it automaticly convert the spaces. I hope I am not being confusing. Any help is welcomed.
poorman is offline  
Old 01-21-2007, 12:40 PM   #2 (permalink)
 
Newb Techie

Join Date: Dec 2006

Posts: 21

Stormdev

Default

What does XMLSongs.php look like? How is the data in that file represented???

Have you tried using the str_replace function? If your xmlsongs.php file uses the return function to return the value of songname when included then you should just be able to wrap your include in the str_replace function to replace unwanted output with output that is needed.

For example if the song title is being 'Returned' by the include statement you should be able to use the following to format the output as it is received from the xmlsongs.php include.

Code:
Current Track:
    <input type="text" name="song" value="<?php echo str_replace("+"," ",include '../XMLsongs.php');?>" size="57">
Hope this helped...
Stormdev is offline  
Old 01-21-2007, 01:07 PM   #3 (permalink)
 
True Techie

Join Date: Feb 2006

Posts: 207

poorman

Default

xmlsongs.php is just a plain text file that is constantly being updated by automation software. example: songtitle - artist

The above solution didn't seem to help but it looks like it has potential. When I put it in it replaced the output in the value in text field with
. I will keep messing around with it and see if I can't make it work. Thanks for the help.
poorman is offline  
Old 01-21-2007, 01:23 PM   #4 (permalink)
 
Newb Techie

Join Date: Dec 2006

Posts: 21

Stormdev

Default

Do you have access to the software that creates the xmlsongs.php file?

If you do and you can change the file to use the return statement to return the song title and artist the code I gave you should work like a charm.

Anyhow, here is more info on str_replace in case you need it:
http://de3.php.net/manual/en/function.str-replace.php

Regards,
Stormdev is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On