Fetch product from amazon mws using product api - amazon-web-services

I have successfully posted product in amazon using amazon MWS Feeds API. Now i want to list those products using the Products API, But im facing some errors.
I run GetMatchingProductSample.php.
Caught Exception: Required parameter ASINList not found Response Status Code: 400 Error Code: MissingParameter Error Type: Sender Request ID: 8bb9c8d1-f48c-495c-be86-89492976b4a9 XML: SenderMissingParameterRequired parameter ASINList not found8bb9c8d1-f48c-495c-be86-89492976b4a9 ResponseHeaderMetadata: RequestId: 8bb9c8d1-f48c-495c-be86-89492976b4a9
Code:
<?php
require_once('.config.inc.php');
$serviceUrl = "https://mws-eu.amazonservices.com/Products/2011-10-01";
$config = array (
'ServiceURL' => $serviceUrl,
'ProxyHost' => null,
'ProxyPort' => -1,
'ProxyUsername' => null,
'ProxyPassword' => null,
'MaxErrorRetry' => 3,
);
$service = new MarketplaceWebServiceProducts_Client(
AWS_ACCESS_KEY_ID,
AWS_SECRET_ACCESS_KEY,
APPLICATION_NAME,
APPLICATION_VERSION,
$config);
$request = new MarketplaceWebServiceProducts_Model_GetMatchingProductRequest();
$request->setSellerId(MERCHANT_ID);
// object or array of parameters
invokeGetMatchingProduct($service, $request);
function invokeGetMatchingProduct(MarketplaceWebServiceProducts_Interface $service, $request)
{
try {
$response = $service->GetMatchingProduct($request);
echo ("Service Response\n");
echo ("=============================================================================\n");
$dom = new DOMDocument();
$dom->loadXML($response->toXML());
$dom->preserveWhiteSpace = false;
$dom->formatOutput = true;
echo $dom->saveXML();
echo("ResponseHeaderMetadata: " . $response->getResponseHeaderMetadata() . "\n");
} catch (MarketplaceWebServiceProducts_Exception $ex) {
echo("Caught Exception: " . $ex->getMessage() . "\n");
echo("Response Status Code: " . $ex->getStatusCode() . "\n");
echo("Error Code: " . $ex->getErrorCode() . "\n");
echo("Error Type: " . $ex->getErrorType() . "\n");
echo("Request ID: " . $ex->getRequestId() . "\n");
echo("XML: " . $ex->getXML() . "\n");
echo("ResponseHeaderMetadata: " . $ex->getResponseHeaderMetadata() . "\n");
}
}

As it says ASINList not found
You need to add these line of code after below line
$request->setSellerId(MERCHANT_ID);
Code needs to add:
$request->setMarketplaceId($marketplace_id);
$asin_list = new MarketplaceWebServiceProducts_Model_ASINListType();
$asins = array("ASIN1","ASIN2","ASIN3");
$asin_list->setASIN($asins);
$request->setASINList($asin_list);

Related

Unexpected Signature while obtaining user session token

I am using Connecty Cube and following the documentation to get a user session token, however the response is
Client error: POST https://api.connectycube.com/session resulted in a 422 Unprocessable Entity response:
{"errors":["Unexpected signature"]}
I am using the below code to get the session token.
use GuzzleHttp\Psr7;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\ClientException;
use GuzzleHttp\Exception\TransferException;
$client = new Client();
// Create Connecty Cube Session
$application_id = env('CUBE_APPLICATION_ID');
$auth_key = env('CUBE_APPLICATION_KEY');
$timestamp = time();
$nonce = substr($timestamp, 0, 4);
$response = $client->request('POST', 'https://api.connectycube.com/session', [
'form_params' => [
'application_id' => $application_id,
'auth_key' => $auth_key,
'timestamp' => $timestamp,
'nonce' => $nonce,
'signature' => hash_hmac('sha1',
http_build_query([
'application_id' => $application_id,
'auth_key' => $auth_key,
'nonce' => $nonce,
'timestamp' => $timestamp,
]),
env('CUBE_APPLICATION_SECRET')
),
"user" => [
"email" => <email address>,
"password" => <password>
]
]
]);
$contents = json_decode($response->getBody()->getContents(), true);
var_dump($contents);
Please help me to figure out where I am going wrong. Thank You!
// Application credentials
DEFINE('APPLICATION_ID', 1204);
DEFINE('AUTH_KEY', "HhBrEq4BRgT4R8S");
DEFINE('AUTH_SECRET', "TkpdsDSSWyD6Sgb");
// endpoints
DEFINE('CB_API_ENDPOINT', "https://api.connectycube.com");
DEFINE('CB_PATH_SESSION', "session.json");
// Generate signature
$nonce = rand();
$timestamp = time(); // time() method must return current timestamp in UTC but seems like hi is return timestamp in current time zone
$signature_string = "application_id=".APPLICATION_ID."&auth_key=".AUTH_KEY."&nonce=".$nonce."&timestamp=".$timestamp;
echo "stringForSignature: " . $signature_string . "<br><br>";
$signature = hash_hmac('sha1', $signature_string , AUTH_SECRET);
// Build post body
$post_body = http_build_query(array(
'application_id' => APPLICATION_ID,
'auth_key' => AUTH_KEY,
'timestamp' => $timestamp,
'nonce' => $nonce,
'signature' => $signature
));
// $post_body = "application_id=" . APPLICATION_ID . "&auth_key=" . AUTH_KEY . "&timestamp=" . $timestamp . "&nonce=" . $nonce . "&signature=" . $signature;
echo "postBody: " . $post_body . "<br><br>";
// Configure cURL
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, CB_API_ENDPOINT . '/' . CB_PATH_SESSION); // Full path is - https://api.connectycube.com/session.json
curl_setopt($curl, CURLOPT_POST, true); // Use POST
curl_setopt($curl, CURLOPT_POSTFIELDS, $post_body); // Setup post body
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); // Receive server response
// Execute request and read responce
$responce = curl_exec($curl);
// Check errors
if ($responce) {
echo $responce . "\n";
} else {
$error = curl_error($curl). '(' .curl_errno($curl). ')';
echo $error . "\n";
}
// Close connection
curl_close($curl);

How to get Country ISO code in OpenCart invoice?

I want zone code in stead of Zone name and Country code in stead of Country name in the invoice only.
Like:
First Name,
Address line 1,
West Sussex, United Kingdom
As:
First Name,
Address line 1, SXW, UK
I've made some modification in the following file:
public_html/_admin/controller/sale/order.php
if ($order_info['shipping_address_format']) {
$format = $order_info['shipping_address_format'];
} else {
$format = '{firstname} {lastname}' . "\n" . '{company}' . "\n" . '{address_1}' . ", " . '{address_2}' . ", " . '{city} {postcode}' . ", " . '{zone_code}' . "\n" . '{country_code}';
}
I'm getting the zone code fine, but not getting Country code, it's showing '{country_code}' only.
How to fix this?
Thanks in advance.
Update file as below:
`$find = array(
'{firstname}',
'{lastname}',
'{company}',
'{address_1}',
'{address_2}',
'{city}',
'{postcode}',
'{zone}',
'{zone_code}',
'{country}',
'{country_code}'
);
$replace = array(
'firstname' => $order_info['payment_firstname'],
'lastname' => $order_info['payment_lastname'],
'company' => $order_info['payment_company'],
'address_1' => $order_info['payment_address_1'],
'address_2' => $order_info['payment_address_2'],
'city' => $order_info['payment_city'],
'postcode' => $order_info['payment_postcode'],
'zone' => $order_info['payment_zone'],
'zone_code' => $order_info['payment_zone_code'],
'country' => $order_info['payment_country'],
'country_code' => $order_info['shipping_iso_code_3']
);
$data['payment_address'] = str_replace(array("\r\n", "\r", "\n"), '<br />', preg_replace(array("/\s\s+/", "/\r\r+/", "/\n\n+/"), '<br />', trim(str_replace($find, $replace, $format))));
// Shipping Address
if ($order_info['shipping_address_format']) {
$format = $order_info['shipping_address_format'];
} else {
$format = '{firstname} {lastname}' . "\n" . '{company}' . "\n" . '{address_1}' . "\n" . '{address_2}' . "\n" . '{city} {postcode}' . "\n" . '{zone}' . "\n" . '{country_code}';
}`
Added country_code in both $find and $replace array.

How to send push to specific member using SNS topic?

I am using AWS SNS to send a push notification, right now i am using publish method of aws-php-sdk to send push specific device. My requirement is sent push to thousands of members within 30 seconds. When i used publish method it takes 5min to send 1000 users.
I have read about topic it sends multiple members at once, but my scenario is i want to send push to specific users, not all topic users.
For example, i register 10,000 members in one topic, but from this 10,000 some time i am sending 9000, sometimes 1000 members.
So anyone has an idea how to send push using topic but specific members only.
I also think another case, every time i create new topic and register member to this topic and then send a message to him and then delete topic, but here every time when register member it is also taking time. So if you have an idea to register multiple members at once then it will also be helpful for me.
Below is my current code to send push.
$arn = "user arn";
$sns = new Aws\Sns\SnsClient(array(
'version' => 'latest',
'key' => my_aws_key,
'secret' => aws_secret,
'region' => region,
'profile' => profile_name,
'debug' => false,
'http' => array('verify' => false)
));
$appArn = "application arn";
$sns->publish(array('Message' => '{ "GCM": "{\"data\": { \"message\": \" This is my message \"} }"}',
'MessageStructure' => 'json',
'TargetArn' => $arn
));
I would recommend to use publishAsync() method.
$userArnCollection = array(
'arn:XXX',
'arn:YYY',
'arn:ZZZ',
);
$sns = new Aws\Sns\SnsClient(array(
'version' => 'latest',
'key' => my_aws_key,
'secret' => aws_secret,
'region' => region,
'profile' => profile_name,
'debug' => false,
'http' => array('verify' => false)
));
foreach ($userArnCollection as $userArn) {
$sns->publishAsync(array(
'Message' => '{ "GCM": "{\"data\": { \"message\": \" This is my message \"} }"}',
'MessageStructure' => 'json',
'TargetArn' => $userArn
));
}
EDIT
Example with promise handling
$userArnCollection = array(
'arn:XXX',
'arn:YYY',
'arn:ZZZ',
);
$sns = new Aws\Sns\SnsClient(array(
'version' => 'latest',
'key' => my_aws_key,
'secret' => aws_secret,
'region' => region,
'profile' => profile_name,
'debug' => false,
'http' => array('verify' => false)
));
$promises = array();
foreach ($userArnCollection as $userArn) {
$promises[] = $sns->publishAsync(array(
'Message' => '{ "GCM": "{\"data\": { \"message\": \" This is my message \"} }"}',
'MessageStructure' => 'json',
'TargetArn' => $userArn
));
}
$results = \GuzzleHttp\Promise\unwrap($promises);
After trying many solutions i am able to send thousands of notification within one minute, here i am showing code how i do it, I have done with php multicurl functionality, so i execute multiple parallel processes and all process send notification simultaneously.
Define multi curl and prepare URL to send notification
Suppose i have 5,000 members and i have array of it's token and other member details $device_type_ids_arr
I part of all member to 500 bunch, so each time curl execute it sends notification to 500 members
$_datas = array_chunk($device_type_ids_arr, 500);
/*initialise multi curl*/
$mh = curl_multi_init();
$handles = array();
/* Perform loop for each 500 members batch */
foreach ($_datas as $batchPart) {
$ch = curl_init();
$postData['devices'] = $batchPart;
$postData['push_content'] = $push_content;
$data_string = json_encode($postData);
curl_setopt($ch, CURLOPT_URL, base_url() . "EmailPipe/sendNotification/"); //your URL to call amazon service (Explain below)
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_USERAGENT, 'User-Agent: curl/7.39.0');
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length:' . strlen($data_string))
);
curl_multi_add_handle($mh, $ch);
$handles[] = $ch;
}
// execute requests and poll periodically until all have completed
$isRunning = null;
do {
curl_multi_exec($mh, $isRunning);
} while ($isRunning > 0);
/* Once all execution are complete remove curl handler */
foreach ($handles as $ch) {
curl_multi_remove_handle($mh, $ch);
}
/* Close multi curl */
curl_multi_close($mh);
Function which is received curl request and send notification
function sendCurlSignal() {
require_once APPPATH . 'libraries/aws-sdk/aws-autoloader.php';
$pipeArr = json_decode(file_get_contents('php://input'), true);
$push_content = $pipeArr["push_content"];
$device_id_arr = $pipeArr["devices"];
$sns = new Aws\Sns\SnsClient(array(
'version' => 'latest',
'key' => "Amazon key",
'secret' => "Amazon secret",
'region' => "region like eu-west-1",
'profile' => "Amazon account user",
'debug' => false,
'http' => array('verify' => false)
));
$appArn = "SNS application arn";
$promises = $results = $retArr = array();
foreach ($device_id_arr as $key => $device_detail) {
$arn = $device_detail['arn']; /* SNS ARN of each device */
$token = $device_detail['token_id']; /* Registered token */
$userid = $device_detail['member_id'];
/* If you don't have arn then add arn for specific token in amazon */
if (empty($arn)) {
try {
$updatedArn = $sns->createPlatformEndpoint(array('PlatformApplicationArn' => $appArn, 'Token' => $token));
$arn = $newArn = isset($updatedArn['EndpointArn']) ? $updatedArn['EndpointArn'] : "";
//update member detail with new arn
if ($newArn != "" && $userid != "" && $token != "") {
/* You can update arn into database for this member */
}
} catch (Exception $e) {
/* Get error if any */
$errorMsg = $e->getMessage();
$newFile = fopen("error_arn_fail.txt", "a+");
fwrite($newFile, "Member Id:" . $userid . "\r\nToken:" . $token . "\r\n" . $errorMsg . "\r\n");
fclose($newFile);
}
}
if (!empty($arn)) {
try {
$promises[$userid] = $sns->publishAsync(array(
'Message' => '{ "GCM": "{\"data\": { \"message\": \"' . $push_content . '\" } }"}',
'MessageStructure' => 'json',
'TargetArn' => $arn
));
$promises[$userid]->arn = $arn;
$promises[$userid]->token = $token;
} catch (Exception $e) {
$errorMsg = $e->getMessage();
$newFile = fopen("error_async_fail_signal.txt", "a+");
fwrite($newFile, $errorMsg . "\r\n");
fclose($newFile);
}
}
}
/* Broadcast push notification */
$results = \GuzzleHttp\Promise\settle($promises)->wait(TRUE);
/* if you want to get result of broadcast and sent message id then do following */
foreach ($results as $key => $value) {
if (isset($value['reason'])) {
/* Reason come in case of fail */
$message = $value['reason']->getMessage();
$token = (isset($promises[$key]->token)) ? $promises[$key]->token : "";
$arn = (isset($promises[$key]->arn)) ? $promises[$key]->arn : "";
if (empty($arn) || empty($token) || empty($key)) {
$newFile = fopen("error_empty_detail_result.txt", "a+");
fwrite($newFile, "Member Id:" . $key . "\r\nArn:" . $arn . "\r\nToken:" . $token . "\r\n");
fclose($newFile);
}
/* Handle error */
if (strpos($message, "Endpoint is disabled") !== false && $token != "" && $arn != "") {
try {
$res = $sns->setEndpointAttributes(array(
'Attributes' => array("Token" => $token, "Enabled" => "true"),
'EndpointArn' => $arn
));
} catch (Exception $e) {
$errorMsg = $e->getMessage();
$newFile = fopen("error_endpoint_disable.txt", "a+");
fwrite($newFile, "Member Id:" . $key . "\r\nArn:" . $arn . "\r\nToken:" . $token . "\r\n" . $errorMsg . "\r\n");
fclose($newFile);
}
}
if (strpos($message, "No endpoint found for the target arn specified") !== false && $token != "") {
try {
$updatedArn = $sns->createPlatformEndpoint(array('PlatformApplicationArn' => $appArn, 'Token' => $token));
$arn = $newArn = isset($updatedArn['EndpointArn']) ? $updatedArn['EndpointArn'] : "";
//update member detail with new arn
if ($newArn != "" && !empty($key) && $token != "") {
/* You can update arn into database for this member */
}
} catch (Exception $e) {
$errorMsg = $e->getMessage();
$newFile = fopen("error_arn_fail.txt", "a+");
fwrite($newFile, "Member Id:" . $key . "\r\nToken:" . $token . "\r\n" . $errorMsg . "\r\n");
fclose($newFile);
}
}
/* After handle error resed notification to this users */
if (!empty($arn)) {
try {
$publishRes = $sns->publish(array(
'Message' => '{ "GCM": "{\"data\": { \"message\": \"' . $push_content . '\" } }"}',
'MessageStructure' => 'json',
'TargetArn' => $arn
));
$retArr[$key] = $publishRes->get("MessageId");
} catch (Exception $e) {
$errorMsg = $e->getMessage();
$newFile = fopen("error_push_not_sent.txt", "a+");
fwrite($newFile, "Member Id:" . $key . "\r\nARN:" . $arn . "\r\nToken:" . $token . "\r\n" . $errorMsg . "\r\n");
fclose($newFile);
}
}
} else {
$retArr[$key] = $results[$key]['value']->get("MessageId");
}
}
/* All member data get into one array to perform database operation */
if (isset($retArr) && !empty($retArr)) {
/* in $retArr you get each member amazon message id */
}
}

Batch Insert data into database using web services in yii2 error

I've tried for get data in web services at http://api.rajaongkir.com/dokumentasi/starter. And I was success show data in view browser. When I implementation for insert data with a lot of into database something any wrong. I don't know why.
This code for get data in web service at http://api.rajaongkir.com/dokumentasi/starter. And put in controllers/TestController.php
public function actionGetProvince($id=0)
{
$client = new client();
$addUrl = ($id>0)?'id='.$id:'';
$response = $client->createRequest()
->setFormat(Client::FORMAT_JSON)
->setMethod('get')
->setUrl('http://api.rajaongkir.com/starter/province?'.$addUrl)
->addHeaders(['key' => 'example'])
->send();
if ($response->isOk) {
$content = \Yii\helpers\Json::decode($response->content);
//$content['rajaongkir']['query']
//$content['rajaongkir']['status']
$results = $content['rajaongkir']['results'];
if ($id > 0) {
if (count($results)>0) {
echo $results['province_id'] . ' - ';
echo $results['province'] . '<br>';
}
else {
echo "blank";
}
} else {
foreach ($results as $provinces) {
echo $provinces['province_id']." - ".$provinces['province']."<br>";
}
}
} else {
$content = \Yii\helpers\Json::decode($response->content);
echo $content['rajaongkir']['status']['description'];
}
}
And this code for insert data with a lot of in database, and I put in file same.
Yii::$app->db->createCommand()->batchInsert('province', [
'id_province' => $provinces['province_id'], 'name' => $provinces['province']
])->execute();
And the result error is :
PHP Warning – yii\base\ErrorException : Missing argument 3 for yii\db\Command::batchInsert(), called in C:\wamp\www\basic_yii2\controllers\TestController.php on line 60 and defined
You are not calling batchInsert() properly.
See it in documentation.
public $this batchInsert ( $table, $columns, $rows )
$table string The table that new rows will be inserted into.
$columns array The column names
$rows array The rows to be batch inserted into the table
Example:
$connection->createCommand()->batchInsert('user', ['name', 'age'], [
['Tom', 30],
['Jane', 20],
['Linda', 25],
])->execute();

I want to update amazon product price using amazon mws api

Any one know how to update amazon product price using Amazon MWS api.
i have updated my product via MWS Scratchpad using feed submission, but i dont know how to send XML Feed to Amazon.
Yaa Amazon is really good with their API documentation Lol....
This might help
$paths = array(
get_include_path(),
realpath(__DIR__ . '/../AmazonAPI/FeedsAPI/src/'),
);
set_include_path(implode(PATH_SEPARATOR, $paths));
unset($paths);
//Includes appropriate config data for Amazon API credentials depending on POS associated with the product
$AWS_ACCESS_KEY_ID = $pos_data['azn_access_key'];
$AWS_SECRET_ACCESS_KEY = $pos_data['azn_secret_access_key'];
$APPLICATION_NAME = $pos_data['azn_app_name'];
$APPLICATION_VERSION = $pos_data['azn_app_version'];
$MERCHANT_ID = $pos_data['azn_merchant_id'];
$MARKETPLACE_ID = $pos_data['azn_marketplace_id'];
$MERCHANT_TOKEN = $pos_data['azn_merchant_token'];
$Service_url = $pos_data['azn_service_url'];
$currency = $pos_data['currency'];
$merchant_token = $MERCHANT_TOKEN;
$config = array(
'ServiceURL' => $Service_url,
'ProxyHost' => null,
'ProxyPort' => -1,
'MaxErrorRetry' => 3);
$service = new MarketplaceWebService_Client($AWS_ACCESS_KEY_ID, $AWS_SECRET_ACCESS_KEY, $config, $APPLICATION_NAME, $APPLICATION_VERSION);
$feed = <<< EOD
<?xml version="1.0" encoding="utf-8"?>
<AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="amzn-envelope.xsd">
<Header>
<DocumentVersion>1.01</DocumentVersion>
<MerchantIdentifier>$merchant_token</MerchantIdentifier>
</Header>
<MessageType>Price</MessageType>
<Message>
<MessageID>1</MessageID>
<Price>
<SKU>$sku</SKU>
<StandardPrice currency="$currency">$new_price</StandardPrice>
</Price>
</Message>
</AmazonEnvelope>
EOD;
echo "\nProduct Price Change Feed for FeedsAPI: \n$feed\n";
$marketplaceIdArray = array("Id" => array($MARKETPLACE_ID));
$feedHandle = #fopen('php://temp', 'rw+');
fwrite($feedHandle, $feed);
rewind($feedHandle);
$parameters = array(
'Merchant' => $MERCHANT_ID,
'MarketplaceIdList' => $marketplaceIdArray,
'FeedType' => '_POST_PRODUCT_PRICING_DATA_',
'FeedContent' => $feedHandle,
'PurgeAndReplace' => false, //Leave this PurgeAndReplace to false so that it want replace whole product in amazon inventory
'ContentMd5' => base64_encode(md5(stream_get_contents($feedHandle), true))
);
rewind($feedHandle);
$request = new MarketplaceWebService_Model_SubmitFeedRequest($parameters);
$return_feed = invokeSubmitFeed($service, $request);
function invokeSubmitFeed(MarketplaceWebService_Interface $service, $request)
{
$DATE_FORMAT = 'Y-m-d';
try
{
$response = $service->submitFeed($request);
echo "\n=============================================================================";
echo "\nSubmitFeedResponse\n";
if($response->isSetSubmitFeedResult())
{
$submitFeedResult = $response->getSubmitFeedResult();
if($submitFeedResult->isSetFeedSubmissionInfo())
{
$feedSubmissionInfo = $submitFeedResult->getFeedSubmissionInfo();
if($feedSubmissionInfo->isSetFeedSubmissionId())
{
echo "FeedSubmissionId: " . $feedSubmissionInfo->getFeedSubmissionId() . "\n";
}
if($feedSubmissionInfo->isSetFeedType())
{
echo "FeedType: " . $feedSubmissionInfo->getFeedType() . "\n";
}
if($feedSubmissionInfo->isSetSubmittedDate())
{
echo "SubmittedDate: " . $feedSubmissionInfo->getSubmittedDate()->format($DATE_FORMAT) . "\n";
}
}
echo "=============================================================================\n";
}
if($feedSubmissionInfo->getFeedProcessingStatus() == "_SUBMITTED_")
{
return TRUE;
}
}
catch(MarketplaceWebService_Exception $ex)
{
echo "Caught Exception: " . $ex->getMessage() . "\n";
echo "Response Status Code: " . $ex->getStatusCode() . "\n";
if($ex->getStatusCode() == 503)
{
echo "\n===> WARNING: AMAZON MWS API REQUEST HAS BEEN THROTTLED <===.\n";
}
echo "Error Code: " . $ex->getErrorCode() . "\n";
echo "Error Type: " . $ex->getErrorType() . "\n";
echo "Request ID: " . $ex->getRequestId() . "\n";
echo "XML: " . $ex->getXML() . "\n";
}
}
Use the Feeds API and if you download one of the client libraries, most of the work is done for you. They currently offer PHP, C#, and Java. Plug in your credentials and then modify the sample code for your use case.