Skip to Content
It is currently January 24th, 2020, 3:26 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: ftp from script
PostPosted: July 24th, 2014, 1:18 am 
Offline
New User
New User

Joined: July 11th, 2014, 2:30 pm
Posts: 10
Is it possible to ftp from a pal script?


Top
 Profile  
Reply with quote  
 Post subject: Re: ftp from script
PostPosted: July 24th, 2014, 3:00 am 
Offline
SVS Member
SVS Member

Joined: December 6th, 2004, 9:00 am
Posts: 7902
Location: Aachen (Germany)
No. The FTP Upload features (or more generally: All the Web related features) are not exposed via PAL.

_________________
Benedikt Bauer - SVS (Spacial Volunteer Support)

We're offering custom PAL / PHP code and general SAM assistance at palscripts.com

My Project:
Send "Now Playing" from SAM to Twitter and/or Facebook | Sourcecode


Top
 Profile  
Reply with quote  
 Post subject: Re: ftp from script
PostPosted: July 24th, 2014, 3:18 am 
Offline
New User
New User

Joined: July 11th, 2014, 2:30 pm
Posts: 10
Yes sorry did a better search and see the same in an post, sorry about that,
And came up with the solution to use webtofile to call a php script that will upload,
If I explain the reason might be better!, I use the ftp within Sam to upload a webpage to server,
The page is created on song change, but I'm finding what's showing is one song behind actually playing, so I thought if I create the page on song change then upload this will fix problem, z.b;
Php code would be like,
Code:
<?php
$file = 'somefile.txt';
$remote_file = 'readme.txt';

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

// upload a file
if (ftp_put($conn_id, $remote_file, $file, FTP_ASCII)) {
 echo "successfully uploaded $file\n";
} else {
 echo "There was a problem while uploading $file\n";
}

// close the connection
ftp_close($conn_id);
?>


And then execute it with

Webtofile(c:\www\(pagewithabovecode))
Executed in a pal script, that runs on song change,
Hope you can see what I'm trying to do, and thanks for the reply


Last edited by Mastacheata on July 24th, 2014, 8:08 am, edited 1 time in total.
fixed code tags


Top
 Profile  
Reply with quote  
 Post subject: Re: ftp from script
PostPosted: July 24th, 2014, 8:11 am 
Offline
SVS Member
SVS Member

Joined: December 6th, 2004, 9:00 am
Posts: 7902
Location: Aachen (Germany)
Almost makes sense. There's just one thing that looks strange to me:
phijim2404 wrote:
Webtofile(c:\www\(pagewithabovecode))

There's no webserver and thus no PHP interpretation involved if you call a file:// (that is implicitly prepended) instead of an http:// URL.
Without interpreting the PHP (or any other server-side code), your code is worthless, though.

_________________
Benedikt Bauer - SVS (Spacial Volunteer Support)

We're offering custom PAL / PHP code and general SAM assistance at palscripts.com

My Project:
Send "Now Playing" from SAM to Twitter and/or Facebook | Sourcecode


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 11 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group