+ Reply to Thread
Results 1 to 8 of 8

Thread: Data Synchronisation between a local xml file and my web server

  1. #1
    Newbie rendy.dev is an unknown quantity at this point
    Join Date
    Jan 2010
    Posts
    4

    Data Synchronisation between a local xml file and my web server

    Hi,

    I need help with a project I am working on. I need to upload/read an xml from a local drive of any platform (linux, windows, mac) and synchronize it with my web server, which will then update my DB. Local xml file path is predefined and stored in my DB. This is part 1.

    Part 2, I will have to update the sync(ed) xml and replace the file on my local drive.

    Part 1 and part 2 will execute in sequence when the user click on a "Sync" button after logged in.

    Here is what I plan to use, PHP, MySQL, Javascript.

    What I know so far.
    1. Due to security reasons we cannot dynamically update the value of the input file type. So setting the known file location is not possible.

    I will like to know if there is anyway we can upload/read & overwrite a xml file without any middleware like adobe air that needs to be pre-installed to any of the platform to achieve what I plan to do?

  2. #2
    Super Moderator WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther's Avatar
    Join Date
    Jul 2006
    Age
    36
    Posts
    11,680
    Blog Entries
    57

    Re: Data Synchronisation between a local xml file and my web server

    I'm not clear on where PHP, JavaScript, or Adobe Air come into this. At the most, PHP should be enough.
    CodeCall Blog | CodeCall Wiki | Shareware
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  3. #3
    Newbie rendy.dev is an unknown quantity at this point
    Join Date
    Jan 2010
    Posts
    4

    Re: Data Synchronisation between a local xml file and my web server

    Nice! So how do I go about using PHP?

    Quote Originally Posted by WingedPanther View Post
    I'm not clear on where PHP, JavaScript, or Adobe Air come into this. At the most, PHP should be enough.

  4. #4
    Super Moderator WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther's Avatar
    Join Date
    Jul 2006
    Age
    36
    Posts
    11,680
    Blog Entries
    57

    Re: Data Synchronisation between a local xml file and my web server

    1) learn PHP. It's usually used to power web-apps but can be used in other ways.
    CodeCall Blog | CodeCall Wiki | Shareware
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  5. #5
    Administrator James.H is on a distinguished road James.H's Avatar
    Join Date
    Nov 2009
    Location
    London
    Posts
    674
    Blog Entries
    1

    Re: Data Synchronisation between a local xml file and my web server

    Check out the tutorial section on PHP to start learning:

    PHP Tutorials - CodeCall Programming Forum

  6. #6
    Newbie rendy.dev is an unknown quantity at this point
    Join Date
    Jan 2010
    Posts
    4

    Re: Data Synchronisation between a local xml file and my web server

    Dear All,

    I tried using PHP but it does not allow me to preset the file I want to upload to the web server. I am working on a social portal that sync data between a portal device via a USB.
    Code:
    <?php
    $ftp_server 
    "localhost";
    $ftp_user_name "rendy";
    $ftp_user_pass "devdev";

    // open some file for reading
    $dfile 'test.php';
    $file 'E:\\test.php';
    $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);

    // check connection
    if ((!$conn_id) || (!$login_result)) {
        echo 
    "FTP connection has failed!";
        echo 
    "Attempted to connect to $ftp_server for user $ftp_user_name";
        exit;
    } else {
        echo 
    "Connected to $ftp_server, for user $ftp_user_name";
    }

    // upload the file
    $upload ftp_fput($conn_id$dfile$fpFTP_ASCII);

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

    <?php
    $ftp_server 
    "localhost";
    $ftp_user_name "rendy";
    $ftp_user_pass "devdev";
    $source_file "E:\\test.php";
    $destination_file "test.php";

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

    // check connection
    if ((!$conn_id) || (!$login_result)) {
        echo 
    "FTP connection has failed!";
        echo 
    "Attempted to connect to $ftp_server for user $ftp_user_name";
        exit;
    } else {
        echo 
    "Connected to $ftp_server, for user $ftp_user_name";
    }

    // upload the file
    $upload ftp_put($conn_id$destination_file$source_fileFTP_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);
    ?>
    Last edited by WingedPanther; 01-13-2010 at 07:56 PM. Reason: add php tags

  7. #7
    Newbie rendy.dev is an unknown quantity at this point
    Join Date
    Jan 2010
    Posts
    4

    Re: Data Synchronisation between a local xml file and my web server

    Note the last post consist of 2 php codes if you noticed

  8. #8
    Super Moderator WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther's Avatar
    Join Date
    Jul 2006
    Age
    36
    Posts
    11,680
    Blog Entries
    57

    Re: Data Synchronisation between a local xml file and my web server

    Next time, please use PHP tags.
    CodeCall Blog | CodeCall Wiki | Shareware
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. How to create a Web Server in Visual Basic 6
    By Dren in forum VB Tutorials
    Replies: 30
    Last Post: 09-15-2009, 11:00 AM
  2. Detect Character Set
    By dargueta in forum General Programming
    Replies: 14
    Last Post: 09-10-2009, 04:55 PM
  3. Linux/Bash: Check if a file exists
    By Tor in forum Shell Scripts
    Replies: 4
    Last Post: 07-10-2009, 01:28 PM
  4. Windows XP Tricks & Tips!!!!..new ones.
    By pranky in forum Tutorials
    Replies: 9
    Last Post: 08-23-2008, 03:22 PM
  5. Setting up server 2003
    By morefood2001 in forum Tutorials
    Replies: 4
    Last Post: 08-18-2008, 10:11 AM

Bookmarks

Bookmarks

     
        Algorithms and Data Structures

        Java tutorials

        Algorithms Forum

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts