/    Sign up×
Community /Pin to ProfileBookmark

How to hide the url of music in php music player

How i can hide the location of my real audio file in php script . So that the user be able to play the song in my website using a pop up real audio player but not to be able to download the file. I be happy if some one show me how i can do that. Thanks

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@SpectreReturnsApr 13.2005 — You could write a C# file which creates a playlist for you.
Copy linkTweet thisAlerts:
@methodauthorApr 13.2005 — You could write a C# file which creates a playlist for you.[/QUOTE]

well i never programmed in c# . so i do not know how. Is there any example some where that i can look at it ?
Copy linkTweet thisAlerts:
@SpectreReturnsApr 14.2005 — [url=http://www.google.ca/search?hl=en&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&q=csharp+tutorial&btnG=Search]Search google?[/url]
Copy linkTweet thisAlerts:
@ShrineDesignsApr 14.2005 — How i can hide the location of my real audio file in php script . So that the user be able to play the song in my website using a pop up real audio player but not to be able to download the file. I be happy if some one show me how i can do that. Thanks[/QUOTE]what you ask for is not possible, in order for someone to listen to a file they have to download it, although, hiding the url to the file is fairly easy, example[code=php]<?php
$dir = 'path/to/mp3s/';

if(isset($_GET['file']))
{
if(file_exists($dir . $_GET['file']))
{
header('Content-type: audio/x-mpeg');
$fp = fopen($dir . $_GET['file'], 'rb');
$mp3 = @fread($fp, filesize($dir . $_GET['file']));
@fclose($fp);
exit($mp3);
}
}
exit('invalid request');
?>[/code]
Copy linkTweet thisAlerts:
@methodauthorApr 14.2005 — what you ask for is not possible, in order for someone to listen to a file they have to download it, although, hiding the url to the file is fairly easy, example[code=php]<?php
$dir = 'path/to/mp3s/';

if(isset($_GET['file']))
{
if(file_exists($dir . $_GET['file']))
{
header('Content-type: audio/x-mpeg');
$fp = fopen($dir . $_GET['file'], 'rb');
$mp3 = @fread($fp, filesize($dir . $_GET['file']));
@fclose($fp);
exit($mp3);
}
}
exit('invalid request');
?>[/code]
[/QUOTE]


Many thanks for u reply . Well i have seen an example in this site that a friend give me but i could not figure it out how they did it !

http://www.afghanhits.com/music/morid/mina.html

By the way how i can call the above code in browser ? does it work for mp3 only? Thank u and looking forward to your reply.
×

Success!

Help @method spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.25,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...