hello, i have a perl script that runs on a windows 2008 server as an schedule task. This script pulls data from one of our vendros' database and then writes out the data in an XML file. The file is saved on the c:\wtxml directory. I need help with a script that will take that XML file and upload it to a Linux server - Redhat, and place it in a directory: /opt/contrib-qa/apache/httdocs/wtxml/ The way I access the Linux server manually, is using SecureFX with a SFTP protocol: contrib-qa-myserver.com, port 22, user, password. I do not have access to the root user, but I have control in all directories inside /opt/contrib-qa/ I know that the Linux server does not run a ssh server, it only runs an ssh client. I am really confused, and unsure on how to do this, at a simple glance it does not look as a very difficult task, but with the scarce resources that I have, and the limited knowledge of the technology it becomes a real challenge. I am providing a copy of the script that writes the XMl file. The move of the file, can either be a separate script, or just an addition to this current one, what ever makes more sense. Any help is very much appreciated. Thank you.
#!/usr/local/bin/perl use warnings; use strict; use Win32::OLE; use Win32::OLE::Const 'Microsoft ActiveX Data Objects'; use XML::Generator::DBI; use XML::Handler::YAWriter; use XML::DOM; my $doc = XML::DOM::Document->new(); my $xml_pi = $doc->createXMLDecl ('1.0'); my $root = $doc->createElement('DATA'); my $objConn = Win32::OLE->new("ADODB.Connection"); my $objCommand = Win32::OLE->new("ADODB.Command"); my $objRecordSet = Win32::OLE->new("ADODB.Recordset"); $objConn->Open("Driver={Webtrends ODBC Driver};Server=webtrend1;Port=7 +099;Database=flrdacbkoji.wct;Uid=****;Pwd=*****;AccountId=1;Language= +english;ProfileGuid=KlDwrNbKgm6;SSL=0;"); $objCommand->{"ActiveConnection"} = $objConn; $objCommand->{"CommandText"} = "SELECT * FROM Pages WHERE Titles <> '' + AND URLs IS NOT NULL AND Titles NOT LIKE House TV : 404 Error Page' +AND Titles NOT LIKE '302 Found' AND URLs <> 'http://housetv.com/' AND + URLs <> 'http://housetv.com/index.htm' AND URLs <> 'http://housetv.c +om/wcm/idcplg/' ORDER BY Visits DESC"; $objRecordSet->{"CursorLocation"} = 3; #adUseClient $objRecordSet->{"CursorType"} = 0; #adOpenForwardOnly $objRecordSet->{"LockType"} = 1; #adLockReadOnly; $objRecordSet = $objCommand->Execute(); my ($rec, $col, $val); while (!$objRecordSet->EOF) { $rec = $doc->createElement('RECORD'); $root->appendChild($rec); $col = $doc->createElement('FIELD'); $col->setAttribute ("Name", "Titles"); $rec->appendChild($col); $val = $doc->createTextNode($objRecordSet->Fields("Titles")->val +ue); $col->appendChild($val); $col = $doc->createElement('FIELD'); $col->setAttribute ("Name", "URLs"); $rec->appendChild($col); $val = $doc->createTextNode($objRecordSet->Fields("URLs")->value +); $col->appendChild($val); $col = $doc->createElement('FIELD'); $col->setAttribute ("Name", "Visits"); $rec->appendChild($col); $val = $doc->createTextNode($objRecordSet->Fields("Visits")->val +ue); $col->appendChild($val); $col = $doc->createElement('FIELD'); $col->setAttribute ("Name", "Views"); $rec->appendChild($col); $val = $doc->createTextNode($objRecordSet->Fields("Views")->valu +e); $col->appendChild($val); $objRecordSet->MoveNext(); } print $xml_pi->toString; print $root->toString; $root->printToFile ("C:\\wtxml\data.xml");

In reply to how to transfer a xml file to server by anavagomez

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.