开发者

rewriting links in scraped content using mod_rewrite

I'm looking to create an iframe on my site that contains amazon.com, and I'd like to control it (see what product the user is at). I realize I can't do this because of browser security policy issues, and the only real workaround is to feed the entire page through my server. So I load the page and I change all the href values from something like

grocery-breakfast-foods-snacks-organic/b/ref=sa_menu_gro7?ie=UTF8&node=16310101&pf_rd_p=328655101&pf_rd_s=left-nav-1&pf_rd_t=101&pf_开发者_StackOverflowrd_i=507846&pf_rd_m=ATVPDKIKX0DER&pf_rd_r=1S4N4RYF949Z2NS263QP

(the links on the site are relative) to 'me.com/work.php?link='.urlencode(theirlink). The problem is the amount of time this takes - plus PHP runs frequently out of memory doing this.

Could I use mod_rewrite to rewrite all domains from:

http://www.me.com/grocery-breakfast-foods-snacks-organic/b/ref=sa_menu_gro7?ie=UTF8&node=16310101&pf_rd_p=328655101&pf_rd_s=left-nav-1&pf_rd_t=101&pf_rd_i=507846&pf_rd_m=ATVPDKIKX0DER&pf_rd_r=1S4N4RYF949Z2NS263QP

to:

http://www.me.com/work.php?url=urlencode(thatlink)

And if not, are there any better options rather then going through every <a> tag?

Thanks!


Have you checked out the associates API? You can get your data that way.

  • https://affiliate-program.amazon.com/gp/advertising/api/detail/main.html
  • http://developer.amazonwebservices.com/connect/entry.jspa?externalID=498&categoryID=14
  • http://astore.amazon.com/
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜