Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

CFHTTP can't get page from Amazon

Posted on 2011-09-14
3
Medium Priority
?
618 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 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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

This article  is about submitting  form through  ColdFusion.Ajax.submitForm to the action page and send a response back in JSON format which later can be decoded using ColdFusion.JSON.decode. By this way you can avoid the usual page refresh for subm…
This is an updated version of a post made on my blog over 3 years ago. It is unfortunately, still very relevant as we continue to see both SQLi (SQL injection) and XSS (cross site scripting) attacks hitting some of the most recognizable website and …
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses
Course of the Month11 days, 14 hours left to enroll

916 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