• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to log the rendered cfhttp URL?

Enthusiast ,
Feb 10, 2016 Feb 10, 2016

Copy link to clipboard

Copied

I have this cfhttp tag.I want to log the URL to see if it's actually having all the correct parameters because it's not working.

<cfhttp result="objRequest" url="#UrlDecode( strTargetURL )#" method="#CGI.request_method#" useragent="#CGI.http_user_agent#" timeout="15">

Views

784

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 10, 2016 Feb 10, 2016

Copy link to clipboard

Copied

<cflog file="_TESTING" text="URL is: #UrlDecode( strTargetURL )#" application="yes" type="information" />

After the code runs, open CFAdmin and go to your LOGS.  Look for the log called _TESTING.

Although, I think that the URL should be UrlENcode() (encoding it for safe browser use.)

V/r,

^_^

PS:  This will get only the value of the FQDN URL, not a URI or any url parameters (unless you're manually setting parameters for the "strTargetURL" variable).  If you want those, you'll have to add:

"?" & cgi.query_string

after the URL.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Feb 11, 2016 Feb 11, 2016

Copy link to clipboard

Copied

Thanks but that does not show me the URL with all the parameters attached to it. Here's the whole cfhttp tag.

<cfhttp result="objRequest" url="#UrlDecode( strTargetURL )#" method="#CGI.request_method#" useragent="#CGI.http_user_agent#" timeout="15">

    <!--- Add the referer that was passed-in. --->

    <cfhttpparam type="header" name="referer" value="#CGI.http_referer#" />

    <cfhttpparam type="url" name="apiKey" value="56a7d8c123131c4058389107">

    <cfhttpparam type="url" name="projectid" value="55c4ffd123131c527e456fe6">

    <cfhttpparam type="url" name="status[$in][]" value="published">

    <cfhttpparam type="url" name="status[$in][]" value="draft">

    

     <!--- Pass along any URL values. --->

    <cfloop item="strKey" collection="#URL#">

        <cfhttpparam type="url" name="phrase" value="#URL[strKey]#" />

    </cfloop> 

  

</cfhttp>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Feb 11, 2016 Feb 11, 2016

Copy link to clipboard

Copied

LATEST

You can easily dump out the request results with CFDUMP, but I have not found an easy way to dump out the request -- you'll have to log each parameter you want to view:

<cflog file="#expandPath('..')#/_TESTING-REQUEST" text="URL: #UrlDecode( strTargetURL )#" application="yes" type="information" />

<cflog file="#expandPath('..')#/_TESTING-REQUEST" text="apiKey: 56a7d8c123131c4058389107application="yes" type="information" />

...

<cfdump var=#objRequest#" output="#expandPath('..')#/_TESTING-RESPONSE" />

(you can combine entries as well)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation