How to get the image url of Amazon product without using the API?

Question

I’ve always used a simple function to get the image url of Amazon products, but a while ago it stopped working on my WordPress website, but it still works on my WordPress website on localhost.

Can anyone give me any ideas to make it work again on my website?

I used this code:

function get_image( $image_url ) {
    $res = wp_remote_get( $image_url );
    $res2 = wp_remote_retrieve_body( $res );
        if (strpos($image_url, 'www.amazon.') !== false) {
            preg_match( '/,"large":"(.*?)",/', $res2, $output );
}
0
, , Carlos B 3 years 2020-08-27T18:10:26-05:00 0 Answers 54 views 0

Leave an answer

Browse
Browse