PEAK XOOPS - Re: [FEATURE REQUEST] Ability to export to ICS from URL. in englishin japanese

Re: [FEATURE REQUEST] Ability to export to ICS from URL.

List posts in the topic

none Re: [FEATURE REQUEST] Ability to export to ICS from URL.

msg# 1.3
depth:
1
Previous post - Next post | Parent - No child | Posted on 2008/9/26 23:13 | Last modified
nroche  二等兵   Posts: 1
Hi,

I run this pearl robot from crontab to do this.
Be carefull with Protector Module that may reject your IP if you insist while testing it.

Nicolas.


#!/usr/bin/perl -w
use strict;
use WWW::Mechanize;
#-------------------
my $login="...";
my $passwd="...";
my $connexionUrl="http://.../index.php";
my $eventsUrl="http://.../modules/piCal/index.php?smode=List&op=all";
#-------------------
my $agent = WWW::Mechanize->new();

# Get cookie and connect
$agent->get($connexionUrl);
$agent->form_number(1);
$agent->field('uname', "$login");
$agent->field('pass', "$passwd");
$agent->click();

# Get event list
$agent->get($eventsUrl);
my $page=$agent->content; 
$agent->form_name('MainForm');
$agent->tick('dummy', 'on');

# Mark all events into checkbox
my $dummy="";
my $number="";
do {
  ($dummy, $page) = split(/<input type='checkbox' name='ids\[\]' value=/, $page, 2);
  if (defined($page))
  {
    ($dummy, $number) = split(/'/, $page, 3);
    $agent->tick('ids[]', "$number");
  }
}
while (defined($page));

# Post form
$agent->click('output_ics_confirm');

# Ask for iCalendar (Windows) format
$agent->form_number(1);
$agent->click('do_output');

# Print iCalendar file
print $agent->content;
Votes:5 Average:4.00

Posts tree

  Advanced search


Login
Username or e-mail:

Password:

Remember Me

Lost Password?

Register now!