php,CodeIgniter-亚马逊产品广告API,如何从产品URL获取ASIN

qnyhuwrf  于 2023-02-27  发布在  PHP
关注(0)|答案(1)|浏览(151)

页面中的一个文本框。用户将从www.example.com粘贴一个产品URL,然后单击文本框旁边的按钮。然后需要接收产品的重量和尺寸,以便稍后使用。按下按钮将调用jquery ajax调用。Amazon.com and then click a button beside the text box. Then weight and dimension of the product needs to be received so that these can be utilized later. pressing the button will invoke a jquery ajax call.
从亚马逊的产品广告记录来看,ASIN似乎是获得产品细节的第一步,但是我如何从产品URL中获得ASIN呢?
示例产品URL为:here.
我使用的是php

5m1hhzi4

5m1hhzi41#

在ruby on rails中,我使用了下面的方法,到目前为止效果很好。

def parse_url
    url=self.url.match("/([A-Z0-9]{10})").to_s
    len = url.size
    url=url.slice!(1,len)
end

这应该是非常相似的PHP。对不起,我不是Maven与PHP正则表达式语法。但祝你好运!这是基于ASIN总是10字符长,并开始与大写字母,组成与字母和数字只。

相关问题