Solved

CFHTTP can't get page from Amazon

Posted on 2011-09-14
3
599 Views
Last Modified: 2012-05-12
I am trying to retrieve the code below, but its either giving me a connection failure.

<cfhttp url= "http://www.amazon.com/gp/offer-listing/B004SGVEKM/ref=dp_olp_new?ie=UTF8&qid=1316049910&sr=1-1&condition=new" result= "res" resolveurl="yes">
<cfhttpparam type= "header" name= "Accept-Encoding" value= "deflate;q=0" />
<cfhttpparam type= "Header" name= "TE" value= "deflate;q=0" >
</cfhttp>

<cfdump var= "#res#" >



If i try the same code, but with a different item details page like:
http://www.amazon.com/Star-Wars-Episode-Blu-Ray-Commemorative/dp/B004SGVEKM/ref=sr_1_1?s=toys-and-games&ie=UTF8&qid=1316049910&sr=1-1

Then it works fine.

What is different between the pages or how can i get a return on the other page?
0
Comment
Question by:theideabulb
3 Comments
 
LVL 52

Accepted Solution

by:
_agx_ earned 400 total points
ID: 36540797
Add a user-agent value

<cfhttp useragent="Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/533.7 (KHTML, like Gecko) Chrome/5.0.391.0 Safari/533.7" ....>

0
 
LVL 11

Assisted Solution

by:Brijesh Chauhan
Brijesh Chauhan earned 100 total points
ID: 36540802
Amazon does not allow direct calls to that page, user USERAGENT attribute so that amazon things that request is comming form a Web Browser, I tested the below and it works..

<cfhttp url= "http://www.amazon.com/gp/offer-listing/B004SGVEKM/ref=dp_olp_new?ie=UTF8&qid=1316049910&sr=1-1&condition=new" result= "res" resolveurl="yes" useragent="Mozilla/5.0 (Windows NT 6.1; rv:7.0) Gecko/20100101 Firefox/7.0">
<cfhttpparam type= "header" name= "Accept-Encoding" value= "deflate;q=0" />
<cfhttpparam type= "Header" name= "TE" value= "deflate;q=0" >
</cfhttp>

<cfdump var="#res#">

Open in new window

0
 

Author Closing Comment

by:theideabulb
ID: 36542780
Nice and it makes perfect sense.  its great that CF allows you to do that.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

CFGRID Custom Functionality Series -  Part 1 Hi Guys, I was once asked how it is possible to to add a hyperlink in the cfgrid and open the window to show the data. Now this is quite simple, I have to use the EXT JS library for this and I achiev…
Recently while working on a project I got a very annoying cfdocument has no body error message. I had never seen this error before. So I checked the code. The code was pretty simple; it was Just showing me the cfdocumnt tag and inside that tag a …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now