Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3341738
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T00:45:26+00:00 2026-05-18T00:45:26+00:00

I am trying to pull a page for parsing information out of it using

  • 0

I am trying to pull a page for parsing information out of it using cfhttp. The page headers that I am calling are:

Content-Encoding: gzip

Connection: Keep-Alive

Content-Length: 19066

Server: IBM_HTTP_Server

Vary: Accept-Encoding, User-Agent

Content-Language: en-US

Cache-Control: no-cache=”set-cookie,

set-cookie2″

Content-Type:

text/html;charset=ISO-8859-1

I set the charset to ISO-8859-1 however I am getting the following in the FileContent (only a small sample is shown below but I think it gets to point across).

EðÑq·Oã?·Ì\ZóL¯þ´Vú5ðbä£ÿæ¾_HÉÒñQãO\Çþãë85ÁÜ
à±°ùÖ}&bßý?,u?2SùQyk5g?UÛ3Ѹfã×ARÃi_iûRã
_ òCA¿-ß."b /¯ßíWÝÆ´}w~,°iøÜCáÇþ@ÃZ5¤ïsÁ8½°ì*
ZÜéjOÝK/Ë4§ÈG5×ä*¬6ÚwÇ0]ã:àÑþé¬G"ÅÁl/t°
jlá»5¶&¯lìYìºØ'yDð½|#ý<ñìTé%¾ï¬ùƪx¶}«±o9»ë¼ÂÆÒï'w8Y?
÷ðxsllû
6íqüGÞsÜóÀx·ªk®XºàåZ{íÁ½åo÷mbq¥ÝÃ8M

I tried other charsets and was considering the gzip encoding to be causing the problem but I am unsure how the test if that is the issue. Any suggestions or help would be greatly valued.

Below is my Code

<cfhttp 
    METHOD="get"
    throwonerror="yes" 
    CHARSET="ISO-8859-1"
    URL="http://www.cars.com/for-sale/searchresults.action?sf1Dir=DESC&prMn=1&crSrtFlds=stkTypId-feedSegId-pseudoPrice&rd=100000&zc=44203&PMmt=0-0-0&stkTypId=28881&sf2Dir=ASC&sf1Nm=price&sf2Nm=miles&feedSegId=28705&searchSource=UTILITY&pgId=2102&rpp=10">

    <cfhttpparam type="Header" name="Accept-Encoding" value="deflate;q=0">
    <cfhttpparam type= "Header" name= "TE" value= "deflate;q=0" >
</cfhttp>

<cfset listings = #cfhttp.FileContent#>
<cfoutput>
    #listings#
</cfoutput>

I have also tried the headers:

    <cfhttpparam type="Header" name="Accept-Encoding" value="*">
    <cfhttpparam type= "Header" name= "TE" value= "deflate;q=0" >

And tried removing the ‘Accept-Encoding’ header and just leaving the TE.

UPDATE:
I still havn’t figured it out, but I found something that might help someone help me out. When I used a test php server of mine to run file_get_contents on the same page and it worked fine, then if I ran the same cfhttp code to call the php page that was calling the page I need it worked just fine. Thanks for the suggestions so far.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T00:45:27+00:00Added an answer on May 18, 2026 at 12:45 am

    The issue with cars.com seems to be that they’re gzipping the output twice (based on this thread)

    So, we need to unzip the content… again…

    First, we need to get the content as binary, so the CFHTTP call needs to include

    getasbinary="yes"
    

    Then, we need to unzip it.

    We can use java.util.zip to do it. The gunzip is a modified version of this cflib.org function:

    <cfhttp
        getasbinary="yes"
        METHOD="get"
        throwonerror="yes"
        CHARSET="ISO-8859-1"
        URL="http://www.cars.com/for-sale/searchresults.action?sf1Dir=DESC&prMn=1&crSrtFlds=stkTypId-feedSegId-pseudoPrice&rd=100000&zc=44203&PMmt=0-0-0&stkTypId=28881&sf2Dir=ASC&sf1Nm=price&sf2Nm=miles&feedSegId=28705&searchSource=UTILITY&pgId=2102&rpp=10" >
    
        <cfhttpparam type="Header" name="Accept" value="application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5">
        <cfhttpparam type="Header" name="User-Agent" value="Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_8; en-US) AppleWebKit/534.7 (KHTML, like Gecko) Chrome/7.0.517.41">
        <cfhttpparam type="Header" name="Accept-Encoding" value="deflate">
        <cfhttpparam type="Header" name="TE" value="deflate, chunked, identity, trailers">
    
    </cfhttp>
    
    <cfset unzippedHTML = gunzip(cfhttp.FileContent)>
    
    <cfoutput>
        #unzippedHTML#
    </cfoutput>
    
    <cfscript>
    
        function gunzip(inBytes) {
            var gzInStream = createObject('java','java.util.zip.GZIPInputStream');
            var outStream = createObject('java','java.io.ByteArrayOutputStream');
            var inStream = createObject('java','java.io.ByteArrayInputStream');
            var buffer = repeatString(" ",1024).getBytes();
            var length = 0;
            var rv = "";
    
            try {
                inStream.init(inBytes);
                gzInStream.init(inStream);
                outStream.init();
                do {
                    length = gzInStream.read(buffer,0,1024);
                    if (length neq -1) outStream.write(buffer,0,length);
                } while (length neq -1);
                rv = outStream.toString();
                outStream.close();
                gzInStream.close();
                inStream.close();
            }
            catch (any e) {
                rv = "";
                try {
                    outStream.close();
                } catch (any e) { }
                    try {
                        gzInStream.close();
                    } catch (any e) {
                        try {
                            inStream.close();
                        } catch (any e) {}
                    }
            }
            return rv;
        }
    </cfscript>
    

    Be sure to double-check the var scoping of the function. I might have missed something.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

element on the page has needed content that i'm trying to pull here's the
I'm trying to pull some data out of logs on remote machines using awk,
I am trying to make a function to pull a page's content from a
I'm trying to pull the text out of a Wikipedia article using their API
I'm trying to pull out page source from a set of pages and run
Hello I am trying to pull information from a page on Wikia for The
I am trying to pull information for items to display on the page. For
I'm trying to pull meta tags out of a html page, to compare two
I'm trying to pull the content from the following Facebook page: https://graph.facebook.com/100000123344690/feed I'm already
I'm trying to pull some information (no recursion necessary) from a jsp page (malformed

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.