SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    AdCaliber Magic2K2's Avatar
    Join Date
    Nov 2001
    Location
    Northern Virginia
    Posts
    496
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Best way to allow others to read a file on my server?

    Hey guys,

    I'm writing a script that others will use on their websites and it will need to fetch some data from my server. Right now, I'm using file_get_contents() as my function for retrieving the information and it appears that will work on PHP 4.3 and above. I like this function because it's simple, but I'm not too familiar with how many servers are likely to support it.

    Does anyone have any suggestions?

  2. #2
    SitePoint Evangelist
    Join Date
    May 2004
    Location
    Germany
    Posts
    550
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    so they are using the script on their servers but still get the data from your server?
    then file_get_contents() has an url as paramter?

    in php.ini is a setting called sth. like allow_url_fopen. if this is enabled it should work, but on the other hand this makes the script vulnerable to cross-site hacking (unless the url is kind of a constant)

    you could take a look at soap

    hope i understood you correctly, else my reply won't make much sense

  3. #3
    AdCaliber Magic2K2's Avatar
    Join Date
    Nov 2001
    Location
    Northern Virginia
    Posts
    496
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Daimaju
    so they are using the script on their servers but still get the data from your server?
    then file_get_contents() has an url as paramter?

    in php.ini is a setting called sth. like allow_url_fopen. if this is enabled it should work, but on the other hand this makes the script vulnerable to cross-site hacking (unless the url is kind of a constant)

    you could take a look at soap

    hope i understood you correctly, else my reply won't make much sense
    Yes, the actual line of code is something like:

    PHP Code:
    $text file_get_contents("http://www.mysite.com/myscript.php"); 
    That line of code is on their web servers. myscript.php is the file on my server that dynamically serves up a line of text based on a couple factors.

    I'm interested in what you are saying about cross-site hacking. Would my script be vulnerable to this type of thing?

    I've heard about SOAP, but never really understood what it was for. I'll take a closer look now to see if I could use it.


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
  •