Using FTP to save a string..

Discussion in 'PHP' started by prabhakar, Sep 7, 2009.

  1. #1
    
    
    $data=<<<EOD
    <h1>Data goes here...</h1>
    EOD;
    
    $connection='localhost';
    ftp_login($connection, user, password);
    ftp_put($connection, somefile.html, $data, FTP_ASCII);
    
    
    PHP:
    This fails as it expects $data to be a resource.. How to store $data into a file with ftp?
     
    prabhakar, Sep 7, 2009 IP
  2. iam.xavier

    iam.xavier Well-Known Member

    Messages:
    521
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    125
    #2
    I would suggest you to write the $data into a file and upload it onto the FTP server.
     
    iam.xavier, Sep 7, 2009 IP
  3. prabhakar

    prabhakar Member

    Messages:
    55
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #3
    Actually I wanted to write a file to the server when fopen() is not allowed. Now I found I can write it to a temporary file & use it as resource.. So problem solved..
     
    prabhakar, Sep 7, 2009 IP