Solved

CFHTTP can't get page from Amazon

Posted on 2011-09-14
3
603 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

PROBLEM:  How to open a cfwindow or run a function on double click of a cfgrid row. One of my clients wanted to be able to double click on a row item to get more detailed information about a transaction and to be able to modify the line items i…
Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

867 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

21 Experts available now in Live!

Get 1:1 Help Now