Skip to main content
Participant
May 3, 2006
Answered

Cfinclude and Absolute Path

  • May 3, 2006
  • 1 reply
  • 1307 views
Hi everyone,

This is my first post here so I hope I'm not annoying you with a dumb newbie question. I searched the forum but didn't find any clue to my current issue.

Right now I'm using ColdFusion 4.5.1 and I don't have much experience using it. I need to include a file (a web page) that is stored on another company's website. I wanted to use the Cfinclude tag because I'm used to proceed this way in PHP but it doesn't seem to be possible to include a distant file using the Cfinclude tag because it doesn't allow absolute path. Is there any alternate way to include a distant file into a Cfm page ?

Thanks for your help !

Have a good day 😉
    This topic has been closed for replies.
    Correct answer drforbin1970
    Use CFHTTP to grab an offsite page and display. The resolveurl attribute keeps hyperlinks in the offsite page functional.
    You can also store the grabbed page in a file, but I don't believe the hyperlinks will work when you cfinclude it. Not 100% sure, check the docs.

    <cfhttp url=" http://www.offsite.com/PageToBeGrabbed.cfm" method="get" resolveurl="Yes">
    <cfoutput>
    #cfhttp.FileContent#
    </cfoutput>

    1 reply

    drforbin1970Correct answer
    Inspiring
    May 3, 2006
    Use CFHTTP to grab an offsite page and display. The resolveurl attribute keeps hyperlinks in the offsite page functional.
    You can also store the grabbed page in a file, but I don't believe the hyperlinks will work when you cfinclude it. Not 100% sure, check the docs.

    <cfhttp url=" http://www.offsite.com/PageToBeGrabbed.cfm" method="get" resolveurl="Yes">
    <cfoutput>
    #cfhttp.FileContent#
    </cfoutput>
    edernAuthor
    Participant
    May 3, 2006
    Thank you very much for your help. It works exactly the way I need it !! It's unfortunate I did not see this function in the documentation.