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)
Related
I have a XYZ service that I run locally that provides me the ability to do REST API calls to fetch JSON data from it. I've been doing the following to get the data into my PHP site:
As you can see I use ob_get_contents(), after I run my curl_exec() functions to communicate with the local service.
Is there a better way than using CURL to access this local REST API service? Or should I just use get_file_contents()?
I am not sure what's your problem with cURL. You have a working solution. I would not use file_get_contents, because you might want to add request headers and handle response headers such as authorization, content-type, cache, error, etc.
We have integrated DocuSign into our application and users are filling all the info and completing the docusign process. Also, we have implemented the functionality using docusign soap API to download envelop that status completed.
But now we want to download all the envelops that are completed. Is there any REST API or Soap API in php to download bulk envelops at a time. If yes please provide the details with examples.
Thanks,
Srinivas Reddy .A
Congratulations on your integration successes!
Do you want to download envelope information or the documents from the envelopers?
Use Connect
The usual technique for integrating completed envelope transactions and documents into existing systems is to use some form of the Connect feature. Connect enables you to establish a web hook, a listener, that is called by the DocuSign platform when envelopes or individual signature requests have reached a particular status level.
When you make an Envelope request through the API, you can include a call back "Connect" url as part of the request. See the eventNotification parameter
You can also establish a Connect listener at the account level instead of including the data with each envelope creation. Your Connect listener can be configured via the API or via the Preferences section of the Classic DocuSign Web App.
Message content documentation when your web hook listener is called by Connect
Another idea is to use the Retrieve product. It downloads completed envelopers and signed documents for you, to a windows server. You can then use local processes to store the data and completed documents.
Documents from envelopes
The API method Get Document from Envelope enables you to retrieve a specific document from an envelope.
Get Envelope Documents and Certificate enables you to retrieve all of the documents.
For both of these, you'd need to first loop through your envelopes to find the ones with the completed status.
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.
I am writing here because am confused with what information I gathered on the topic I am going to discuss..
There is a phonegap app which had a backend server previously, and it is now removed. So, the client is trying to use a new webservice API (RESTful service) which gives the desired results. The complete requirement of the client is:
Make the app work using new webservice API.
Use an intermediate server app that invokes the new webservice API only once in a day.
The end-users (mobile app users) should get data from the intermediate server. NOT from the webservice API directly.
The result produced by the webservice API is JSON. Now it needs to be handled at the intermediate server and the result should be stored in a database (MySQL, MSSQL or any other). whenever mobile app user requests data, result should be retrieved from the intermediate server. This server gets data from the webservice API periodically.
For this I understood that PHP could be a better option to connect to the webservice API. I tried to get through this http://blog.ijasoneverett.com/2013/02/rest-api-a-simple-php-tutorial/
Can anyone help me getting a full working example of such a scenario? I am comfortable with accessing the data from Server to mobile device but I am not sure how to establish a connection between the Server and the webservice API.
Kindly let me know if I need to provide more inputs here.
I used SOAP UI to test my implementation and it works there. However, I do not know how to do this without SOAP UI in a php environment.
I currently have php code pulling data from the MySQL database and outputting well-formed XML, but I do not know how to send this XML output to the web service to be processed.
Any help would be great.
Thanks
You don't have to create your own SOAP XML. There is a perfectly fine SOAP extension available, where you can create a SoapClient using the services WSDL-file.
http://ch1.php.net/soap
If it is really only about sending the data, use curl.
Configuration example: How can I send SOAP XML via Curl and PHP?