Jump to content

Need help with direct download to host


hno

Recommended Posts

HI,

I need to write an script which download files from the input type .I have wrote a code but it first download the file's content then make the file with that content but something that I want to do is to download the video from the link and put that directly into the host without need to be downloaded into the user's computer something like leech.

How can I do so ?

 

Thanks

Link to comment
Share on other sites

Your requirements are not 100% clear, can describe in details.

Sorry,English is not my native language ,

I need to write a script that get url from the user which is a url of a file then the script has to download that file to the host without need to download to the users computer

For example the user enter :'www.test.com/test.flv" in the field then the script has to download that file and put it in 'www.mywebsite.com/test.flv' without downloading the video content in users computer and making the file again I mean the host should download the video not user .

I hope I can say that clear.

 

Thanks

Link to comment
Share on other sites

So basically you want your website to be able to steal content?

 

file_get_contents might work.

 

NOT actually,

the problem of file_get_contents is that the php going to download the whole file's content so it takes some time to download the file but I want that the host do that I mean the host going to download the content not the user's computer

Link to comment
Share on other sites

file_get_contents would load the contents to the server, not the client. It's going to take time to download no matter what, but if you really want to download something you might need to look into running a shell script that downloads a file.

 

http://stackoverflow.com/questions/1834678/how-to-show-file-download-progress-in-php-shell-scripting

 

If you are stealing other site content, I hope you get caught and burned. Otherwise, have a nice day.

Link to comment
Share on other sites

file_get_contents would load the contents to the server, not the client. It's going to take time to download no matter what, but if you really want to download something you might need to look into running a shell script that downloads a file.

 

http://stackoverflow.com/questions/1834678/how-to-show-file-download-progress-in-php-shell-scripting

 

If you are stealing other site content, I hope you get caught and burned. Otherwise, have a nice day.

 

Actually I have write that with file_get_contents :this is the line:

file_put_contents($img, file_get_contents($url));

which $img is the name of the file to be created and the $url is the url which we are going to download

I read about file_get_contents and it was mentioned that it Reads entire file into a string so It must be client side not server side because When it reads the file into a string , we have downloaded the file content into user's computer .

But I want to be server side and the user does not have to download the content of the file  something like leech websites that just show the progress and nothing is going to downloaded into user's computer

 

Thanks all

Link to comment
Share on other sites

Just, no. PHP is a server side processor. Everything happens on the server unless you decide to output the file to the browser.

 

so ,something is wrong with my code?because every time if the user's want to download a file with more than 10MB it would take so long and in many cases it would never be complete and some times even the website is hang.Why is that?I'm using this code "file_put_contents($img, file_get_contents($url));" for making downloading the file .Is there any other way to download the file faster ,I mean really faster with the speed of the server?

 

Thanks

Link to comment
Share on other sites

hello hno,

 

Can you do file_put_contents operation offline, like as per your requirements, create a cron job and update your files using file_put_contents. So when client is trying to download, a file creation time get reduced and client should not wait for the time.

 

I hope you are clear with above solutions.

Link to comment
Share on other sites

hello hno,

 

Can you do file_put_contents operation offline, like as per your requirements, create a cron job and update your files using file_put_contents. So when client is trying to download, a file creation time get reduced and client should not wait for the time.

 

I hope you are clear with above solutions.

 

Hi my friend,

No , I can't . I have to make the file  right after downloading.Is there any other way to do that?

Thanks

Link to comment
Share on other sites

You do realize that if you are making it to download from host to host there can be bandwidth limitations between the hosts. And depending on the file size it can take long time. And for the user, this will show just loading page during the time it moves the filedata. Which will be uber gay, say to wait for 5mins for a page load.

Link to comment
Share on other sites

You do realize that if you are making it to download from host to hos there can be bandwidth limitations between the hosts. And depending on the file size it can take long time.

 

Bandwidth limitation is not a case.But you know for downloading a 10MB file from host to host It should not take so long in the other word more than 1 min.

 

Link to comment
Share on other sites

I just reread this and I dont know if this is what you're getting at or not...

 

You want to copy the file from another server... To your server. That way the user can still see the file without downloading it.

 

If this is the case... Hummm... It is pointless. Especially with video, unless you are streaming it. If they are watching the video in the web browser, they are still downloading it. They are just downloading it to their temporary files directory.

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.