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

Passing variables with cfhttp

Explorer ,
Dec 28, 2013 Dec 28, 2013

Copy link to clipboard

Copied

I need to pass a dynamic variable using cfhttp. 

This code:

<cfhttp method="get" url="#cgi.server_name#/page.cfm?pageid=#pageid#" resolveurl="Yes">

<cfoutput>

    #cfhttp.FileContent#

</cfoutput>

Returns the error:

The 3 parameter of the Mid function, which is now -8, must be a non-negative integer.

This code returns the same error.

<cfhttp method="post" url="#cgi.server_name#/page.cfm" resolveurl="Yes">

    <cfhttpparam type="Formfield"

        value="#pageid#"

        name="pageid">

</CFHTTP>

<cfoutput>

    #cfhttp.FileContent#

</cfoutput>

Any assistance would be appreciated.

Views

1.0K

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
Community Beginner ,
Dec 28, 2013 Dec 28, 2013

Copy link to clipboard

Copied

You don't say what line in your code is throwing the error...???  Try putting a

     <CFDUMP var="#cgi#">

before the first line and a

     <CFDUMP var="#cfhttp#">

after the CFHTTP call.  That will help you to understand if there is something wrong with the CGI var you are trying to pass as part of the URL, and will also show you whether the CFHTTP gets executed and what the return status is. Let us know how that works out and we can help you with further debugging.

good luck!

reed

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
Community Expert ,
Jan 04, 2014 Jan 04, 2014

Copy link to clipboard

Copied

LATEST

Search for the function mid() in the current page or in page.cfm. The error message is clear enough. The third argument of the method is currently -8, whereas it has to be a positive integer.

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