Skip navigation
malletheadjw
Currently Being Moderated

CFHTTP problem - is file-type extension required

Jun 4, 2009 6:40 AM

Hello,

 

Running CF8 on Win2003/IIS. 

 

I have the following simple code to check a value from another server:

 

<cfhttp method="get" URL= "http://server.somewhere.com/websvc/util?a=doHTMLRequest&event=workgrou pstat"   throwonerror="yes">

<cfset theContent = "#cfhttp.FileContent#">

<cfoutput>#theContent#</cfoutput>

 

I have also tried:

 

<cfhttp
  method="get"
  url="http://server.somewhere.com/websvc/util">  (with and without the ? after the word util)
  <cfhttpparam name="a" type="URL" value="doHTMLRequest">
  <cfhttpparam name="event" type="URL" value="workgroupstat">
</cfhttp>

 

The URL that is shown above returns nothing when using it within CFHTTP. If I change the URL to http://www.google.com or whatever I get the code of that page assigned to my theContent variable as expected 

 

From a browser, the URL used in the cfhttp function above works fine. The request returns a simple HTML file with the following code from which I need to pull the agents_available data:

 

<HTML><HEAD><TITLE>Agents Available</TITLE></HEAD><BODY><H2>workgroup:Chat</H2><H2>agents_avail able:1</H2><H2>agents_logged_in:1</H2></BODY></HTML>

 

I cannot understand why I can call any other page from the internet (and our network) and put it into my theContent variable but I can't call this one.  Could it be something in the structure of the URL??

 

I'm thinking that the CFHTTP function cannot properly format the request without the file-type extension.

 

Any ideas are appreciate.  Regards, Jerry

 
Replies
  • Currently Being Moderated
    Jun 4, 2009 7:38 AM   in reply to malletheadjw

    The two steps I would use to start analysing this problem.

     

    1) Change the <cfhttp...> to use the throwonerror="no" AND redirect="no" parameters and then use <cfdump var="#cfhttp#"> afterword.

     

    This should show you exactly what the server is returning to you for these request you are making, not just the content.

     

    2) Do the request in a browser such as FireFox with the HTTP Headers plugin and look at all the content that is being sent between the browser and the server.  Look closely at any post, get and cookie headers that are being sent and then povide matching content in your <cfhttp...> tag.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 4, 2009 10:58 AM   in reply to malletheadjw

    Is it possible that the page at http://server.somewhere.com/websvc/util is user-agent aware and is treating requests from a web browser differently from requests from CFHTTP?  You might try providing a value for the useragent attribute of CFHTTP to mimic IE or Firefox's user agent string.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 4, 2009 12:25 PM   in reply to malletheadjw

    malletheadjw wrote:

     

    I'm beginning to think it's in the setup of the web service - maybe an access setting like in cffunction where it is set to public, private, remote, etc.

     

    I am truly baffled.

     

    Jerry

     

    That would not make much sense, if you can access it from a browser, then it is responding to remote requests.

     

    I do not remember, is this web service on the internet or a local intranet?  If it is a local intranet is it perchance on an IIS web server configured to use "Integrated Windows Security"?

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points