You are here:  » Amazon search results

Active Forum Topics


Amazon search results

Submitted by Perce2 on Mon, 2020-06-08 14:13 in

Hi David,

hope you are well.

Recently you have helped me with getting the new Amazon APIv5 working, but I have one site that doesn't want to play ball. Like with the previous version of pto_api_amazon.php is there a way to set debug so I can find where the problem lies?

Thanks.

Submitted by support on Mon, 2020-06-08 14:51

Hi,

Sure - in the v5 pto_api_amazon.php look for the following code around line 164:

    return count($pto_searchResults);

...and REPLACE with:

    if (!isset($pto_api_amazonItems->SearchResult->Items))
    {
      print "<pre>".curl_error($ch)."</pre>";
      print "<pre>".$response."</pre>";
    }
    return count($pto_searchResults);

The raw JSON response will then be displayed if no search result response received. The error messages are normally quite informative, if you're not sure from what is displayed let me know the output (or if no difference of course) and I'll check it out further with you...

(don't forget to remove the debug code once up and running...)

Cheers,
David.
--
PriceTapestry.com

Submitted by Perce2 on Tue, 2020-06-09 06:41

Hi David,

thanks for the code.
Gave it a go but didn't get any response, just a small empty block with background colour.
Checked and the server has "allow_url_fopen" turned on.

Any ideas?

Thanks.

Submitted by support on Tue, 2020-06-09 07:25

Hi,

The new version uses CURL in order to set headers easily, you mentioned it was working OK on other sites so may be a connectivity issue - i've modified the debug code above adding this line;

  print "<pre>".curl_error($ch)."</pre>";

...please try with that in place and let me know if there is now any visible debug output when no Amazon results displayed...

Thanks,
David.
--
PriceTapestry.com

Submitted by Perce2 on Tue, 2020-06-09 08:49

Thanks David,

with the amended code now in place am getting:

"Failed to connect to webservices.amazon.co.uk port 443: Connection refused"

Have you seen this before?

Thanks.

Submitted by support on Tue, 2020-06-09 09:04

Hi,

That sounds like maybe a firewall is preventing your server from making outbound connections on the https port (443) - I doubt the connection refused is actually coming from Amazon servers.

You mentioned the V5 API scripts working on other sites - if they are on the same server as this site that would indicate otherwise; but if this is on a different server I would contact your hosting technical support, mention that your server is running a script that needs to connect to AWS servers (webservices.amazon.co.uk) on port 443 and they should be able to advise further...

Cheers,
David.
--
PriceTapestry.com

Submitted by Perce2 on Tue, 2020-06-09 09:09

Thanks David, I'll contact the host.

Cheers!