Web サイトの PHP スクリプトで .ics ファイルを作成し、そのファイルをコンピューターのローカルに保存していますが、iCal Exchange アカウントにアップロードして、そこから共有できるようにしたいと考えています。
iCal (アプリ) 経由でアップロードできますが、PHP 経由で行う必要があります。iCalExchangeにはユーザー名とパスワードがあり、指示には次のように書かれています:
iCal から新しいカレンダーを公開するには、[Web サーバーで公開] オプションを選択し、次のいずれかの URL を使用します。
http://icalx.com/private/zeroan/
http://icalx.com/public/zeroan/
新しいユーザー名とパスワードを正しく入力してください。
私はこれをPHPで試しましたが、うまくいきませんでした:
$ftp_server='74.91.122.152';//serverip
$conn_id = ftp_connect($ftp_server);
// login with username and password
$user="zeroan";
$passwd="****";
$login_result = ftp_login($conn_id, $user, $passwd);
// check connection
if ((!$conn_id) || (!$login_result)) {
echo "FTP connection has failed!";
echo "Attempted to connect to $ftp_server for user $ftp_user_name";
die;
} else {
echo "<br>Connected to $ftp_server, for user $user<br>";
}
//directorylike /www.velibaba.com/images
ftp_chdir($conn_id, "http://icalx.com/public/zeroan/");
//$destination_file=ftp_pwd($conn_id);
$source_file='cale.ics';
$destination_file="calendario.ics";
echo ("<br>");
print $destination_file;
echo ("<br>");
// upload the file
$upload = ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY);
// check upload status
if (!$upload) {
echo "FTP upload has failed!";
} else {
echo "Uploaded $source_file to $ftp_server as $destination_file";
}
// close the FTP stream
ftp_close($conn_id);
ありがとう