problem with include function, please help!

Discussion in 'PHP' started by crazy.works, Jun 7, 2010.

  1. #1
    Hi, i have a script, the script work great on a lot of servers, but today i got very weird problem with if condition and include function on a customer server..
    on the script my function work with if condition....( if include myfile do "a", and if not do "b" )
    if(include("http://url/file.php")){ echo "a"; }else{ echo "b" }

    and the problem and the weird thing is on this server it check the include, it make the include, but it echo "b" not "a" !!!!!
    anybody have any idea about the reason of this problem please ??? !!!
     
    crazy.works, Jun 7, 2010 IP
  2. javaongsan

    javaongsan Well-Known Member

    Messages:
    1,054
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    128
    #2
    try file_exists instead of include.
     
    javaongsan, Jun 7, 2010 IP
  3. roopajyothi

    roopajyothi Active Member

    Messages:
    1,302
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    80
    #3
    Yeah right!
    Use File_exists :)
     
    roopajyothi, Jun 8, 2010 IP
  4. silviuks

    silviuks Peon

    Messages:
    43
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    You cannot include a php file from another server ... if the script is on the same server, you can (first) check if the file exists (with file_exists command as previous comments suggested you) and then include it, but if scripts are located on different servers you have to find other solutions (curl, web services ... )
     
    silviuks, Jun 9, 2010 IP
    MyVodaFone likes this.
  5. roopajyothi

    roopajyothi Active Member

    Messages:
    1,302
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    80
    #5
    Curl can be used to get contents
    Like wise you can also used to check the existence of the file from header :)
     
    roopajyothi, Jun 9, 2010 IP