hon3y
Copy profile linkMember since August 2012 · Last seen 8 years ago
42 posts 0 accepted answers 0 reputation 4 followers 4 following
Junior
%20 = space for url format. so if when grabbing url %20 is not appeared but space does. then use str_replace on grabbed link to turn space into %20
$filelink = str_replace(' ', '%20', $filelink);
here is 2 examples of showing how to mod the info to be displayed and yet keep original url info in tact.
<?php echo 'Using str_replace() '; $file = 'http://m.djsongz.com/musicdata/Needan_Ft._Jasmeen_Akhtar_-_(Djsongz.Com).mp3'; $title = str_replace('http://m.djsongz.com/musicdata/', '', $file); $title = str_replace('_-_(Djsongz.Com).mp3', '', $title); echo '<a href="'.$file.'">'.$title.'</a> '; echo 'Using preg_replace() '; $file2 = 'http://m.djsongz.com/musicdata/Needan_Ft._Jasmeen_Akhtar_-_(Djsongz.Com).mp3'; $title2 = preg_replace('/http\:\/\/m\.djsongz\.com\/musicdata\//', '', $file2); $title2 = preg_replace('/_-_\(Djsongz\.Com\)\.mp3/','', $title2); echo '<a href="'.$file2.'">'.$title2.'</a>'; ?>heres a demo page to see them. http://codemafia.uk.to/test.php
Note: demo page is my computer. so maybe down at certain times. plus i wont keep this page up for too long anyhow.
this will remove all text and just leave the mp3 name and still keep url intact.
$file = 'http://m.djsongz.com/musicdata/Needan_Ft.Jasmeen_Akhtar-(Djsongz.Com).mp3'; $title = str_replace('http://m.djsongz.com/musicdata/', '',$file); $title = str_replace('-_(Djsongz.Com).mp3', '',$title);
echo '<a href="'.$file.'">'.$title.'</a>';
here is a demo of it working.
http://codemafia.uk.to/test.php
i will send you a preg_replace example also in a few minutes.
hmm you could try making a 2nd variable for the purpose of just a title.
like. $file = 'http://m.djsongz.com/musicdata/Needan_Ft.Jasmeen_Akhtar-(Djsongz.Com).mp3'; title = str_replace('-_(DjSongz.CoM).mp3','',$file);
echo '<a href="'.$file.'">'.title.'</a>';
this will keep download link in tact. and remove the string from title on your page.
but it cant remove from the original url from grabbed site. as you dont have control of their server.
use a preg_replace or str_replace on the variable thats gathering the id.
like: $mp3 = preg_replace('/(IndianWap.Mobi)/', '', $mp3); or: $mp3 = str_replace('(IndianWap.Mobi)', '', $mp3);
before echoing/displaying/getting the final result.
if that is not what you need. then maybe look into using .htaccess for url rewrite rules. although im not good with rewrite rules so may need to ask someone else.