SitePoint Sponsor

User Tag List

Results 1 to 8 of 8

Hybrid View

  1. #1
    SitePoint Zealot ozonew4m's Avatar
    Join Date
    Apr 2006
    Location
    at my desk
    Posts
    136
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    off site list into php file

    lets say i have a few sites on various urls, hosts, on various platforms, php setups etc.


    what would be the easiest way to have a list of values in a central location on one host that i could import into an array in php from all locations..

    so every site could import the data..

    ive tried php includes but it doesnt work because some hosts have php setup to stop it.

    i thought about using xml but i dont know how to output or import it

    any suggestions?

  2. #2
    SitePoint Evangelist
    Join Date
    Aug 2005
    Posts
    453
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use a text file, something along the line of CSV... Variable, value
    Computers and Fire ...
    In the hands of the inexperienced or uneducated,
    the results can be disastrous.
    While the professional can tame, master even conquer.

  3. #3
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Your options are URL file-wrappers (include/require/fopen/file/file_get_contents/readfile...), sockets, the cURL libraries, or executing a shell command.

    URL file-wrappers are disabled at many hosts as you've discovered, which means you can't use any file functions to retrieve files outside the local server.

    http://us2.php.net/fsockopen for info on opening a socket and reading from it.

    The curl library may or may not be available... depends on the host again.

    And unlikely to be available at a host that bothered to turn off URL file wrappers is the ability to run shell commands.. to exec()/shell_exec() a wget or curl via CLI to download.

    I don't think there's any solution guaranteed to work if you don't have control over the environment.

  4. #4
    SitePoint Member
    Join Date
    Sep 2006
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    A delimited text file and "split" is going to be the quickest/easiest way.

    -Jason
    DopeDomains.com - 20,000 New domains a day starting at $5
    sorted by Pagrank, Hits, Length, etc.
    Find the perfect name cheap!

  5. #5
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Mysticserver View Post
    A delimited text file and "split" is going to be the quickest/easiest way.

    -Jason
    But that doesn't address his question of how to get that text file to each copy of the program...

  6. #6
    SitePoint Evangelist
    Join Date
    Aug 2005
    Posts
    453
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use an include statement, two caveats
    1. Make sure the file is in a directory which has read privileges set for world.
    2. Make sure the file is not included in the list of files not permitted for hot linking? ( would be just like an image file which you have set for deny hot linking in your C-panel.
    Computers and Fire ...
    In the hands of the inexperienced or uneducated,
    the results can be disastrous.
    While the professional can tame, master even conquer.

  7. #7
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by byron3@earthlink View Post
    Use an include statement, two caveats
    1. Make sure the file is in a directory which has read privileges set for world.
    2. Make sure the file is not included in the list of files not permitted for hot linking? ( would be just like an image file which you have set for deny hot linking in your C-panel.
    >

    Quote Originally Posted by ozonew4m
    ive tried php includes but it doesnt work because some hosts have php setup to stop it.

  8. #8
    SitePoint Evangelist
    Join Date
    Aug 2005
    Posts
    453
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    One last thought, have you considered ftp_fget()?
    You must have an ftp service with your domain.
    Documentation @ : http://us.php.net/function.ftp-fget
    Computers and Fire ...
    In the hands of the inexperienced or uneducated,
    the results can be disastrous.
    While the professional can tame, master even conquer.


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
  •