Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Trying to automate an ftp between two websites
Old 09-09-2008, 12:36 PM Trying to automate an ftp between two websites
Experienced Talker

Posts: 38
Name: Alan
Trades: 0
I am trying to automate some tasks to update a couple of websites. The site I am working on now needs to do the following:

1. Create a tab delimited .txt file of selected database entries
2. Download the .txt file from above to local machine
3. Upload the .txt file to another website to update database in that site.

Being basically lazy, I want to automate the entire process. I need some guidance on this. Perhaps there are already scripts available but I was not able to find any in a search of script directories.

I have heard of CURL but really know nothing about that library. If you can point me in the right direction to learning that would be fantastic.
__________________

Please login or register to view this content. Registration is FREE
alhefner is offline
Reply With Quote
View Public Profile Visit alhefner's homepage!
 
 
Register now for full access!
Old 09-10-2008, 04:31 AM Re: Trying to automate an ftp between two websites
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
You don't need to ftp. On server 1 you create a script that will output the tabbed data, on server 2 you may simply file_get_contents() to retrieve that data by url and do whatever you want with it.
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Old 09-10-2008, 10:17 AM Re: Trying to automate an ftp between two websites
Experienced Talker

Posts: 38
Name: Alan
Trades: 0
My bad! I forgot the little detail that I only have access to the first server. The other one is another company I am trying to interface with. I have talked to them and though they don't have an API, they are OK with me trying to do the FTP operations using CURL.

Logging in to the ftp server for the other site is easy enough but I still need to upload the tab delimited text file and associated photos.
__________________

Please login or register to view this content. Registration is FREE

Last edited by alhefner; 09-10-2008 at 10:20 AM..
alhefner is offline
Reply With Quote
View Public Profile Visit alhefner's homepage!
 
Old 09-10-2008, 10:31 AM Re: Trying to automate an ftp between two websites
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
Why don't you use the ftp related functions of PHP ?
http://www.php.net/manual/en/function.ftp-fput.php
PHP Code:
// open some file for reading
$file 'somefile.txt';
$fp fopen($file'r');

// 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);

// try to upload $file
if (ftp_fput($conn_id$file$fpFTP_ASCII)) {
    echo 
"Successfully uploaded $file\n";
} else {
    echo 
"There was a problem while uploading $file\n";
}

// close the connection and the file handler
ftp_close($conn_id);
fclose($fp); 
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Reply     « Reply to Trying to automate an ftp between two websites
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.95678 seconds with 12 queries