1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

PHP question re:Coop Network

Discussion in 'PHP' started by crew, Dec 15, 2004.

  1. #1
    One of my Coop sites all of a sudden won't validate. It's a larger problem then just the Coop, though, so I'm posting in here.

    It appears my server does not like serving files that are trying to be accessed from a php include from an outside server. Running a php page on the same server,

    include ('http://www.mysite.com/robots.txt');

    does not work, but this...

    include ('/home/myusername/public_html/robots.txt');

    does work.

    The error is...

    Warning: main(http://www.mysite.com/robots.txt): failed to open stream: HTTP request failed! HTTP/1.1 403 Forbidden in /home/myusername/public_html/myfile.php on line 13
    SEMrush
    I've chmod-ed to 777 just for kicks and it does not help. I used WGet from a telnet session and it can get the file. I can get to the robots.txt file fine from a browser. It seems to be only absolute addressed files from php includes.

    Any suggestions are appreciated.
     
    crew, Dec 15, 2004 IP
    SEMrush
  2. schlottke

    schlottke Peon

    Messages:
    2,185
    Likes Received:
    63
    Best Answers:
    0
    Trophy Points:
    0
    #2
    are you hosting it on your own server.
     
    schlottke, Dec 15, 2004 IP
  3. crew

    crew Peon

    Messages:
    225
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #3
    nope, shared server.
     
    crew, Dec 15, 2004 IP
  4. expat

    expat Stranger from a far land

    Messages:
    873
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #4
    what did you do befor you did nothing...

    switched hot link protection on by any chance?

    M
     
    expat, Dec 15, 2004 IP
  5. crew

    crew Peon

    Messages:
    225
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #5
    "switched hot link protection on by any chance?"

    Nope. Just completely disabled it to check and had the same results. That was a good guess though that I hadn't thought of. thanks.
     
    crew, Dec 15, 2004 IP
  6. expat

    expat Stranger from a far land

    Messages:
    873
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #6
    mhhh so you try from domain a to call a file in domain b or is it within the same domain?
    M
     
    expat, Dec 16, 2004 IP
  7. crew

    crew Peon

    Messages:
    225
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #7
    within same domain. If I use the relative URL it works fine, if I use the absolute URL it doesn't work.
     
    crew, Dec 16, 2004 IP
  8. rvarcher

    rvarcher Peon

    Messages:
    69
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #8
    I'm not sure what's causing your problem but there's a couple of things that would cause you not to be able to include using http.

    URL fopen wrappers has to be enabled.

    and "Windows versions of PHP prior to PHP 4.3.0 do not support accessing remote files." even with URL fopen wrappers enabled.

    I found this info at:
    http://us2.php.net/include/
     
    rvarcher, Dec 16, 2004 IP
  9. expat

    expat Stranger from a far land

    Messages:
    873
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #9
    yes I can only think of this one as well

    php info should show
    allow_url_fopen "1" PHP_INI_SYSTEM

    it's normally in php.ini

    on the other hand you should simply be able to use the following code

    include("{$_SERVER['DOCUMENT_ROOT']}/mydocument.xxx");
    or
    include("{$_SERVER['DOCUMENT_ROOT']}/folder/mydocument.xx");

    cheers
    M
     
    expat, Dec 16, 2004 IP