File_Get_Contents bad Request using Amazon MWS Class - php

Trying to request ten amazon product prices using the MWS API. If I paste the URL into my browser it works but the class supplied by Amazon in their code library doesnt.
Warning: file_get_contents(https://mws-eu.amazonservices.com/Products/2011-10-01?ASINList.ASIN.1=B0009U5CRC&ASINList.ASIN.10=B000AB25HA&ASINList.ASIN.2=0007192231&ASINList.ASIN.3=B000639DWM&ASINList.ASIN.4=B000639DWM&ASINList.ASIN.5=B000AOX7DI&ASINList.ASIN.6=B000ARIMNA&ASINList.ASIN.7=B001CD3PII&ASINList.ASIN.8=B000FOPOBQ&ASINList.ASIN.9=B00004CX5P&AWSAccessKeyId=AKIAJ5HY2TM5PQJSQN6Q&Action=GetLowestOfferListingsForASIN&ExcludeMe=true&MarketplaceId=A1F83G8C2ARO7P&SellerId=AJUM2E3VZ43L&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2014-09-28T09%3A00%3A25Z&Version=2011-10-01&Signature=Xt5sfG%2Fo7ebYfrHg%2B6mm%2FkeS0GEal%2FYzPFbv2laJBoY%3D): failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request
in /var/www/vhosts/_classes/class.MWSProducts.php on line 69
The code generating the issue is here
http://pastebin.com/A9qvRSpg
I know some may suggest curl but I don't particularly want to start altering code supplied by amazon too much.

I think you should try using "https://mws.amazonservices.co.uk/Products/2011-10-01" as service URL if you are using Amazon UK's API and "https://mws-eu.amazonservices.com/Products/2011-10-01" for EU API.

Related

Dropbox API: HTTP status 400 {"error": "v1_retired"}

I am trying to upload a file to Dropbox using their API. I have already followed the complete tutorial, but I cannot seem to figure it out.
When I execute it, I am facing the following error message along with HTTP 400 - Bad Request:
{"error": "v1_retired"}
My composer.json file is as follows:
You are getting that error message because version 1 of the Dropbox API is no longer available, as stated on the GitHub repository of the library you used. The tutorial you were using was probably outdated.
https://github.com/dropbox/dropbox-sdk-php
"Do not use this SDK. It relies on Dropbox API v1, which is obsolete."
The README advises you to use any of the provided community libraries which can be found at this page.

Is XML parsing blocked on amazon product API requests?

I am trying to parse/recieve the XML from the amazon product API. When sending a api request to amazon I can successfully receive a url containing the XML data for the product(s). When I try to use the simplexml_load_file() function in php I get a connection refused.
Is this amazon blocking the use of this sort of request, or is it more likely a problem on my end? (I am only testing in XAMPP)

Can I run a Soap Request Using PHP SoapClient In Opencart 2?

I need to process a Soap Request inside opencart 2, I built the soap request in a normal PHP file to start with and placed this in the root of my website, after I got that working I thought it would just be a case to add a function inside opencart 2 and place the soap request code in there. Now i can call the right function and the method containing the soap request but as soon as opencart try's to process the new soap client line which is :-
$newclient = new SoapClient('https://example.com/catalog/controller/soap/efiWSDL27.wsdl');
I get the following error:-
Proxy Error
The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request POST /index.php.
Reason: Error reading from remote server
If I comment out this line, then the rest of the function runs ok, apart from anything that relies on the soap request.
So to be clear Im getting this error before I try and call the soap request further down the function, It happens purely on the new soapclient statement.
Do I need to specify any other parameters when I do the new soap client from within Opencart
I know the wsdl is reachable, Im lost on this one, like I say the exact same code will work on the same webspace in a plain php file outside of opencart. I also tried a different webservice with a remote wsdl and I still get this same error in side opencart?
please help me :)
Not Exactly The Right Answer, But the solution for me was to use the nusoap library rather than the built-in soapclient in PHP and then it worked perfectly.

[function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request

I have an error while logging a user to my application using facebook login.
I found similar question in previous answered question but when I apply I still have the same error.
The question was clear and You can check it here.
Can anyone who had the same problem try to help me to add the exit statement as it was answered in above told question.
You should use Facebook (PHP) SDK
http://developers.facebook.com/docs/reference/php/
The Facebook SDK for PHP provides a rich set of server-side functionality for accessing Facebook’s server-side API calls. These include all of the features of the Graph API and FQL.
It can only be said time and time again:
Using the PHP SDK makes dealing with the API a lot easier, than doing things “manually” with file_get_contents. So please consider using that instead, for your own benefit.
When file_get_contents used with HTTP URLs gets something other than a 2xx HTTP response code, it generates just a warning, and does not give you the HTTP response body, which in those cases usually contains the actual reason for the error.
To get this body and therefor the actual error message, you have to use file_get_contents with a context parameter with the HTTP context option ignore_errors set to true.

Google Checkout error, "Build failed with an exception"

I want to implement Google Checkout in my PHP project (running on Apache). I put the callback URL in my merchant center account. My Checkout is in sandbox mode. When placing an order I get the following error message in my merchant center:
We encountered an error trying to access your server at myurl.org -- the error we got is
Send failed with code: 401.
Response body was: Failed to Get Basic Authentication Headers
Since neither version of this question has been addressed, I figure I'll add some advice to the one I edited:
I'm not at all familiar with Google Checkout and its API, but a quick Wikipedia search for HTTP error informs me that a 401 error is because authentication has failed. Note, this is not the same as the authentication being rejected (error 403: Forbidden) but rather that the actual attempt to authenticate failed. A good analogy might be to imagine going to a door, being asked for the secret password (which we'll say is Fedelio) and instead of saying "Applesauce" and getting beat up for trespassing (error 403) instead you respond with "Huh?" and the gate keeper simply stands there wondering if you even know what he meant by password.
The same wiki article refers to Basic Authentication in relationship to this error. I highly reccommend taking a look into that as well.
Long story short, your users need to authenticate when the URL is requested, but it sounds like you are trying to request the site server-side or through some kind of redirect, so the server is returning the 401 error instead of returning a login prompt.

Categories