?
Solved

CFHTTP can't get page from Amazon

Posted on 2011-09-14
3
Medium Priority
?
615 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 52

Accepted Solution

by:
_agx_ earned 1600 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 400 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

PROBLEM: How to add your own buttons to the bottom toolbar with paging info ( result count ). While creating a cfgrid, I ran into an issue where I wanted to embed my own custom buttons where the default ones ( insert / delete / etc… ) are for aes…
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 …
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

719 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