SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot Jafar's Avatar
    Join Date
    Jun 2005
    Posts
    167
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How i can write to a file from localhost when it located on another server?

    Hi,
    I want to edit a certain file on my server by executing a php file from localhost, but when i try to do that, i receive an error.
    I use fopen
    Code:
    $url = 'http://www.site.com/file.htm';
    $handle = fopen($url, "w+");
    The permission of file.htm is 777 on server.
    here is the error:
    failed to open stream: HTTP wrapper does not support writeable connections
    How i can enable it?
    Thnx

  2. #2
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am not sure what exactly is happening in your case but if you go for FTP functions and connect to your server using FTP and get/write from local.
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5

  3. #3
    SitePoint Wizard Hammer65's Avatar
    Join Date
    Nov 2004
    Location
    Lincoln Nebraska
    Posts
    1,161
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    fopen in write or append modes, only work with the local file system. Think about it this way. What you have just done is ask a remote server to grant the ability to edit a file on it's file system to an anonymous user on the internet. No user name or password.

    As mentioned you can use PHP/FTP for this, or some sort of web service connection set up between your local script and the remote server.


Bookmarks

Posting Permissions

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