Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more

Go Back   Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more > Web Programming > PHP Development
User Name
Password

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 07-31-2007, 12:13 PM   #1 (permalink)
Frank Shaw
Junior Member
 
Join Date: Jun 2007
Posts: 14
Default I am trying to write a PHP script to download a WMV - viedo from my web site - page

Here is my following php script what I am trying to do is build a download script to download from my server using ftp a WMV file which is also stored on the web root of my server also. My server is a windows server if that makes difference?


I am trying to have a web page have a link that calls the download.php script on the server and down load the viedo file with the ext WMV and then have the file if so dirsred payed on the local computer – the reason to do this is to avoid the heavy bandwidth usage of trying to play the viedo across the internet from the web page.



Here is the php script – I have removed the ip address the username and password from this script – I stored the information for now in the top of the script in $varables other then that the script should be intact .


if you have some time see what you see could be the problem ! I think but not shure it has something to do with the fopen and the file being FTP to the local computer being in the WMV format. But not shure?


<?php
// path to remote file
$ftp_server = // '00.00.000.000';
$ftp_user_name = 'username';
$ftp_user_pass = 'password';
$remote_file = 'remote.wmv';
$local_file = 'local.wmv';

// open some file to write to
$handle = fopen($local_file, 'wb');

// set up basic connection
$conn_id = ftp_connect($ftp_server);
if (!$conn_id)
{
echo ' Error could not connent to ftp server <br />';
exit;
}
echo ' connected to ftp server <br />';

// login with username and password
@ $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
if (!$login_result)
{
echo "Error: Could not log on as <br />";
ftp_quit($conn_id);
exit;
}
echo "Login in was succesful <br />";

// try to download $remote_file and save it to $handle
if (ftp_fget($conn_id, $handle, $remote_file, FTP_BINARY, 0))
{

echo "Red Hot Stocks Is Updating";
echo "successfully written to" . $local_file . "\n";
} else {
echo "There was a problem while downloading $remote_file to" . $local_file . "\n";
}
echo "Red Hot Stocks Is Updating";

// close the connection and the file handler
ftp_close($conn_id);
fclose($handle);
?>

Here are the error messages

If this helps

Warning: fopen(cnbcprofile.wmv) [function.fopen]: failed to open stream: Permission denied in C:\Inetpub\vhosts\redhotstocks.com\httpdocs\downlo ad.php on line 11

Warning: fclose(): supplied argument is not a valid stream resource in C:\Inetpub\vhosts\redhotstocks.com\httpdocs\downlo ad.php on line 12
connected to ftp server
Login in was succesful

Warning: ftp_fget() expects parameter 2 to be resource, boolean given in C:\Inetpub\vhosts\redhotstocks.com\httpdocs\downlo ad.php on line 34



THANKS


Frank H. Shaw
Frank Shaw is offline   Reply With Quote
Sponsored Links
Old 08-01-2007, 01:10 AM   #2 (permalink)
EdurfSofdar
Junior Member
 
Join Date: Jul 2007
Posts: 1
Post Finance articles

Sorry for offtop, but what the best finance articles source you know?
What you'll recommend me?
EdurfSofdar is offline   Reply With Quote
Old 08-01-2007, 01:30 AM   #3 (permalink)
Frank Shaw
Junior Member
 
Join Date: Jun 2007
Posts: 14
Default Re: I am trying to write a PHP script to download a WMV - viedo from my web site - page

Please have some come curistity - If i am not wrong but i did post this problem in a PHP develpoment fourm and area and only expect a responce that is related to that and not some other issue. Please if posiable remove your responce from my thread and post your what ever in a correct catergory.

THANKS

Frank H. Shaw
Frank Shaw is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

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

Points Per Thread View: 1.00
Points Per Thread: 11.00
Points Per Reply: 5.00



» Sponsors

» Links

» Affiliates
Web Hosting
Online Backup Reviews
Marketing Find
Merchant Select
SiteMap Builder
Host Compare
Dedicated Servers

» Links

» Sports Network
Paintball Forum
Football Forum
Hockey Forum
Golf Forum
Boxing Forum
Lacrosse Forum
Baseball Forum
SnowBoarding Forum
Soccer Forum
MMA Forum


All times are GMT -4. The time now is 11:10 PM.



LinkBacks Enabled by vBSEO 3.0.0 RC8
Webmaster Forums