Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Pro PHP
| Search | Today's Posts | Mark Forums Read
Pro PHP Advanced PHP coding discussions. Beginning-level questions will be redirected to the Beginning PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 12th, 2008, 04:26 AM
Authorized User
 
Join Date: Nov 2004
Location: Bhavnagar, Gujarat, India.
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Snowby
Default How to download files from server without any FTP

Friends,


I want to download files from live server with PHP without using any FTP software.

e.g. I want to provide few functionality to my client in which my PHP page will download text files from www.mydown.com/textfile folder and store in my intranet server for further processing of data.

Please guide me how to do this with PHP ?


Regards,
Dhaval Dave

 
Old May 9th, 2008, 06:25 PM
richard.york's Avatar
Wrox Author
Points: 5,506, Level: 31
Points: 5,506, Level: 31 Points: 5,506, Level: 31 Points: 5,506, Level: 31
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Camby, IN, USA.
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

You have not supplied enough data. Based on what you've said, you don't need PHP to do it at all, all you need to do is put up links to the files you want to download, and they will happily download over HTTP.

Why do you think you need PHP to do it?


Regards,
Rich

--
Author,
Beginning CSS: Cascading Style Sheets For Web Design, 2nd Edition
CSS Instant Results

http://www.catb.org/~esr/faqs/smart-questions.html
 
Old May 11th, 2008, 06:54 AM
Friend of Wrox
Points: 1,515, Level: 15
Points: 1,515, Level: 15 Points: 1,515, Level: 15 Points: 1,515, Level: 15
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2003
Location: Oxford, , United Kingdom.
Posts: 488
Thanks: 0
Thanked 3 Times in 3 Posts
Default

This sort of thing?

Code:
<?php
// set up basic connection
$conn_id = ftp_connect($ftp_server); 

// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); 

// check connection
if ((!$conn_id) || (!$login_result)) { 
        echo "FTP connection has failed!";
        echo "Attempted to connect to $ftp_server for user $ftp_user_name"; 
        exit; 
    } else {
        echo "Connected to $ftp_server, for user $ftp_user_name";
    }


// try to download $server_file and save to $local_file
if (ftp_get($conn_id, $local_file, $server_file, FTP_BINARY)) {
    echo "Successfully written to $local_file\n";
} else {
    echo "There was a problem\n";
}

// close the connection
ftp_close($conn_id);
--
Charlie Harvey's website - linux, perl, java, anarchism and punk rock: http://charlieharvey.org.uk




Similar Threads
Thread Thread Starter Forum Replies Last Post
Download files from FTP dbellavi ASP.NET 1.0 and 1.1 Professional 7 July 19th, 2007 11:54 AM
Download files from FTP dbellavi C# 0 June 14th, 2007 02:16 AM
Transferring files to ftp server mar4ik Servlets 0 September 14th, 2006 06:15 AM
How to Download the files from FTP using DTS surileo SQL Server DTS 1 September 29th, 2004 01:23 PM
FTP download files with same extension otarboy Pro VB 6 0 September 28th, 2004 04:50 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.