I have a sample code I got from a documentation provided by a merchant. I think the code is in C#. I need to write a code for PHP but I don't have any idea about C# so I'm having a problem with this. I've tried to write a PHP code for this but it doesn't seem right.
By the way, this is a webservice kind of setup and it uses WCF to expose various endpoints. Here's the endpoint they've provided to me: http://services.scorpion.biz/Public/Leads/ExternalLead.svc
Here's the C# code:
public bool SubmitLead(string contactName, string contactNumber) {
bool outcome = false;
string message = string.Empty;
if (contactNumber.Length <= 9) {
message = "Telephone number is too short";
outcome = false;
} else if (contactNumber.Length > 11) {
message = "Telephone number is too long";
outcome = false;
} else if (contactNumber.Length == 10 && contactNumber[0] != '0') {
message = "Telephone must start with a ZERO";
outcome = false;
} else if (contactNumber.Length == 11 && contactNumber.Substring(0, 2) != "27") {
message = "Telephone must start with a 27";
outcome = false;
} else {
WSExternalLead.LeadRequestMessage request = new
WSExternalLead.LeadRequestMessage();
request.Message = “Your Keyword” + ". Contact Name: " + contactName + ".
Contact Number: " + contactNumber;
request.TelephoneNumber = contactNumber;
request.Network = “IMU”;
request.ReceivedTime = DateTime.Now;
using (WSExternalLead.ExternalLeadClient client = new WSExternalLead.ExternalLeadClient()) {
try {
WSExternalLead.LeadResponseMessage response = null;
response = client.GenerateLead(request);
if (response.Result != true) {
message = "We were unable to process your request at this
time. Error: " + response.ErrorMessage;
outcome = false;
} else {
message = "Thank you for your interest in Scorpion Legal
Protection. We will get back to you shortly.";
outcome = true;
}
} catch (FaultException fx) {
message = "We were unable to process your request at this time.
Fault: " + fx.Message;
outcome = false;
} catch (Exception ex) {
message = "We were unable to process your request at this time.
Exception: " + ex.Message;
outcome = false;
}
}
}
HttpContext.Current.Session["OUTCOME"] = outcome;
HttpContext.Current.Session["MESSAGE"] = message;
return outcome;
}
Here's the PHP code that I've written:
// Read values to variables
$username = $_GET['un'];
$usersurname = $_GET['ul'];
$phonesubmit= $_GET['up'];
$useremail = $_GET['ue'];
$aff_id = $_GET['aff'];
$unique_id = $_GET['uid'];
$rdate = date('m/d/Y G:i:s');
$rdate = date("c", strtotime($rdate));
$wsdlFile = "http://services.scorpion.biz/Public/Leads/ExternalLead.svc?WSDL";
$client = new SoapClient($wsdlFile);
$variables->TelephoneNumber = $phonesubmit;
$variables->Message = "IMU. Name: $username $usersurname. Contact Number: $phonesubmit";
$variables->Network = "IMU";
$variables->ReceivedTime = $rdate;
$result = $client->GenerateLead($variables);
$returnMessage = $result->Result;
$returnMessage = trim($returnMessage);
if ($returnMessage == ""){
$returnMessage = $result->ErrorMessage;
}
Any idea on how to solve this would be greatly appreciated. Thanks.
Related
This is a c# method that invokes SAP BAPI.
public Message ReleaseBapi(string orderNumber)
{
Message msg = new Message();
DataTable dt = new DataTable();
_ecc = ERPRfcDestination.InitialiseDestination();
try
{
IRfcFunction api = _ecc.Repository.CreateFunction("BAPI_PRODORD_RELEASE");
IRfcTable orderNumTable = api.GetTable("ORDERS");
orderNumTable.Insert();
IRfcStructure ItemData = orderNumTable.CurrentRow;
orderNumber = orderNumber.PadLeft(12,'0');
ItemData.SetValue("ORDER_NUMBER", orderNumber);
api.SetValue("ORDERS", orderNumTable);
BeginContext();
api.Invoke(_ecc);
//EndContext();
IRfcTable detReturnTable = api.GetTable("DETAIL_RETURN");//On this line I am getting RfcInvalidStateException
IRFCToDatatable convertToDT = new IRFCToDatatable();
dt = convertToDT.ToDataTable(detReturnTable, dt);
if (dt.Rows.Count > 0)
{
msg.Msg = "Order number " + orderNumber + " released";
msg.MsgType = "S";
}
else { RollbackAPI(); }
}
catch (Exception ex)
{
msg.MsgType = "D";
msg.Msg = ex.Message;
RollbackAPI();
}
finally
{
EndContext();
}
return msg;
}
I checked every other instances where similar line of code is written and on debugging I found that it works as expected. Above is the only place where I am getting this error although I was able to invoke the Rfc method.
I am converting code from visual basic to C#, the code converted to C# is as follows:
if (txt_Username.Text == string.Empty || txt_pwd.Text == string.Empty || txt_Installation.Text == string.Empty)
{
lbl_AlertDanger.Visible = true;
lbl_AlertDanger.Text = "<center><strong>ERROR</strong> -Ingrese Credenciales</center>";
}
else if (txt_Username.Text.Length > 1 && txt_pwd.Text.Length > 1 && txt_Installation.Text.Length >= 1)
{
try
{
ds_Student_Login.SelectParameters["Installation"].DefaultValue = txt_Installation.Text.Trim();
ds_Student_Login.SelectParameters["Username"].DefaultValue = txt_Username.Text.Trim().ToLower();
ds_Student_Login.SelectParameters["Pwd"].DefaultValue = txt_pwd.Text.Trim();
ds_Student_Login.DataBind();
DataView o_Selecte_UserData = ((DataView)(ds_Student_Login.Select(DataSourceSelectArguments.Empty)));
foreach (DataRow o_UserData in o_Selecte_UserData.Table.Rows)
{
if (o_UserData["Result_Cd"] == "OK")
{
HttpCookie v_CkLastLogin = new HttpCookie("FM_LastLogin");
v_CkLastLogin.Values["Username"] = txt_Username.ToString();
v_CkLastLogin.Values["Installation"] = txt_Installation.ToString();
v_CkLastLogin.Expires = DateTime.Now.AddDays(30);
Response.Cookies.Add(v_CkLastLogin);
Session["s_Username"] = o_UserData["Username"];
Response.Redirect("LSProducts.aspx", true);
}
}
}
catch (Exception ex)
{
lbl_AlertDanger.Visible = true;
lbl_AlertDanger.Text = "<center><strong>ERROR</strong> - " + ex.Message + </center>";
}
}
the "Result_Cd" is a response that is obtained from a stored procedure, I'm getting an error in this line
DataView o_Selecte_UserData = ((DataView)(ds_Student_Login.Select(DataSourceSelectArguments.Empty)));
and it says:
Execution timeout timed out. The time-out period elapsed before the completion of the operation or the server is not responding.
Why with VB.net if it leaves me why with C#?
I am using PushSharp 4.0.10.0 library to send the notification on iOS devices but it's not working. I have debugged it and found there is some ApnsConfiguration connection problem.
I am using this code to send the notificaiton:
public IHttpActionResult Notify()
{
HttpResponseMessage response = new HttpResponseMessage();
HttpContent requestContent = Request.Content;
string errorMessage = "Some error occured.please try again later";
HttpStatusCode responseCode = HttpStatusCode.Unauthorized;
string requestParameter = requestContent.ReadAsStringAsync().Result;
string tokan = "";
var r = Request;
var header = r.Headers;
try
{
if (requestParameter != null)
{
PushNotificationModel complaintModel = JsonConvert.DeserializeObject<PushNotificationModel>(requestParameter);
JsonConvert.DeserializeObject<PushNotificationModel>(requestParameter);
var appleCert = File.ReadAllBytes(HttpContext.Current.Server.MapPath("~/Images/User/xyz.pem"));
var config = new ApnsConfiguration(ApnsConfiguration.ApnsServerEnvironment.Production,
appleCert, "xyz");
// Create a new broker
var push = new ApnsServiceBroker(config);
int DeviceType = 1;
string deviceId = Convert.ToString(complaintModel.deviceToken);
string message = "New notification!!";
Guid complaintId = complaintModel.ComplaintId;
string detail = complaintModel.detail;
try
{
//System.Web.Hosting.HostingEnvironment.MapPath("~/Images/User/")
// var appleCert = File.ReadAllBytes(HttpContext.Current.Server.MapPath("~/Images/User/CTPwd.pem"));
push.OnNotificationFailed += (notification, aggregateEx) =>
{
aggregateEx.Handle(ex =>
{
// See what kind of exception it was to further diagnose
if (ex is ApnsNotificationException)
{
message = ex.Message;
}
else
{
message = "Not an APNSException";
}
// Mark it as handled
return true;
});
};
try
{
push.OnNotificationSucceeded += (notification) =>
{
message = "New Notification";
};
push.Start();
string appleJsonFormat = "{\"aps\": {\"alert\":" + '"' + message + '"' + ",\"sound\": \"default\"}}";
//string appleJsonFormat = "{\"aps\": {\"alert\": " + "Hello World" + ",\"sound\": \"default\"}}";
push.QueueNotification(new ApnsNotification
{
DeviceToken = deviceId,
Payload = JObject.Parse(appleJsonFormat)
});
push.Stop();
}
catch(Exception ex)
{
}
I have searched on google, but did not find any relevant answer. Is there any syntax problem ?
Thanks in advance.
Please use .P12 file format for push notification happy coding:)
I have no idea.. why this occurs.
In debug mode it is running well .
however, now I am trying to run my project in IIS web server and
it doesn't runs well.
I can access the main page of my project. but when I try to access the local database, the following error shows up.
this is my log file and codes:
catch (Exception ex)
{
Debug.WriteLine("Error in integration: " + ex.Message);
Debug.Flush();
StreamWriter file2 = new StreamWriter("c:\\resources\\file.log", true);
file2.WriteLine("아님여기?"+ex.Message);
file2.Close(); //디버깅 계속................
}
In this catch I have the following error:
provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server
I am sorry that I can not explain which line is generating this exception because there's no exception occurring in debug mode...
Here is the code for Page Load:
protected void Page_Load(object sender, EventArgs e)
{
this.Page.Form.Enctype = "multipart/form-data";
WA = Request.QueryString["WA"];
if (string.IsNullOrEmpty(WA)) WA = "off";
string qstr = null;
qstr = Request.QueryString["vCnt"]; //ㅇㅈ이파라메터 들은 어디서...??
if (qstr != null && qstr != "") vCnt = Int32.Parse(qstr);
if (!IsPostBack)
{
Keywords = Request.QueryString["keywords"]; //ㅇㅈ search main -> searh 버튼 클릭
VideoSearch = Request.QueryString["VideoSearch"];//ㅇㅈ ~^~^~
// 스마트폰에서 포스팅 되었을 때
if (Request.UserAgent.Contains("Android"))
{
if (Request.Cookies["VIDEOSEARCH"] != null && Request.Cookies["VIDEOSEARCH"].Value != "")
{
VideoSearch = Request.Cookies["VIDEOSEARCH"].Value;
MAM.Models.Utils.CookieManager("VIDEOSEARCH", "");
}
}
if (!String.IsNullOrEmpty(Keywords) && !Keywords.Contains("null")) SearchTextbox2.Text = Keywords;
Debug.WriteLine("search text is " + SearchTextbox2.Text);
Debug.Flush();
try
{
if (!string.IsNullOrEmpty(VideoSearch))
{
//ㅇㅈ DNA를 추출하여 유사 동영상을 돌려받음.
string results = RetrieveDNAfromVideo(System.Web.HttpUtility.UrlDecode(VideoSearch)/*video name*/);
string[] lines = results.Split(new string[] { "\r\n" }, StringSplitOptions.None);
vSearchResults = new List<VSearchResult>();
foreach (string line in lines)
{
string[] words = line.Split(',');
VSearchResult vSearchResult = new VSearchResult();
vSearchResult.VideoID = Int32.Parse(words[0]);
vSearchResult.idx = Int32.Parse(words[1]);
vSearchResult.RGBdifferce = Int32.Parse(words[2]);
vSearchResults.Add(vSearchResult);
} //ㅇㅈ vSearchResults : RetrieveDNAfromVideo가 알려준유사동영상정보
MAMDataContext db = new MAMDataContext();
List<int> VideoIDs = (List<int>)vSearchResults.Select(v => v.VideoID).ToList();
//vdo = (List<Video>)(from a in db.Video
// join b in vSearchResults
// on a.id equals b.VideoID
// orderby b.RGBdifferce
// select a).ToList();
vdo = (List<Video>)(from a in db.Videos
where VideoIDs.Contains(a.id)
select a).ToList(); //ㅇㅈ vdo는 결국, RetrieveDNAfromVideo가 알려준유사동영상정보-> id가 같은동영상들
vSearchResults2 = new List<VSearchResult2>();
VSearchResult v1 = null;
foreach (Video v in vdo)
{
VSearchResult2 v2 = new VSearchResult2();
v2.VideoID = v.id;
v2.overview = v.overview;
v2.title = v.title;
v2.filename720 = v.filename720;
v2.filename360 = v.filename360;
v1 = vSearchResults.Where(t => t.VideoID == v.id).OrderBy(t => t.RGBdifferce).FirstOrDefault();//ㅇㅈ ㅇㄱㅁㅇ
// ㅇㅈ RetrieveDNAfromVideo가 알려준유사동영상정보-> id가 같은동영상들[-> RGBdifferce가 가장작은 애] [] 무슨의미??
v2.idx = v1.idx;
v2.RGBdifferce = v1.RGBdifferce;
vSearchResults2.Add(v2);
}
Debug.WriteLine("Video Serach done");
Debug.Flush();
}
if (!string.IsNullOrEmpty(Keywords))
{
string ret2 = null;
string str1 = null;
if (string.IsNullOrEmpty(Keywords))
{
Keywords = SearchTextbox2.Text;
}
if (string.IsNullOrEmpty(str1)) str1 = Keywords; //ㅇㅈ str1 은 질의의도??
string[] searchTextArray = str1.Split(' ');
int cnt1 = searchTextArray.Count();
string st1 = ""; string st2 = ""; string st3 = "";
if (cnt1 > 0) st1 = searchTextArray[0];
if (cnt1 > 1) st2 = searchTextArray[1];
if (cnt1 > 2) st3 = searchTextArray[2];
MAMDataContext db = new MAMDataContext();
vdo = (List<Video>)db.Videos.Where(v => v.overview.Contains(st1)
|| (cnt1 > 1 ? v.overview.Contains(st2) : false)
|| (cnt1 > 2 ? v.overview.Contains(st3) : false)).ToList();//ㅇㅈ 검색어를 overview에 가지고 있는 동영상 리스트
vSearchResults2 = new List<VSearchResult2>();
foreach (Video v in vdo)
{
VSearchResult2 v2 = new VSearchResult2();
v2.VideoID = v.id;
v2.overview = v.overview;
v2.title = v.title;
v2.filename720 = v.filename720;
v2.filename360 = v.filename360;
v2.idx = 0;
v2.RGBdifferce = 0;
vSearchResults2.Add(v2);
}
Debug.WriteLine("Video Search");
}
}
catch (Exception ex)
{
Debug.WriteLine("Error in integration: " + ex.Message);
Debug.Flush();
StreamWriter file2 = new StreamWriter("c:\\resources\\file.log", true);
file2.WriteLine(ex.Message);
file2.Close(); //디버깅 계속................
}
Debug.WriteLine("Search End");
}
if (fUpload.PostedFile != null) //ㅇㅈ
{
fileupload1();
}
else
{
}
}
this is a guess because you did not provide a key information: the connection string.
my guess is that the application is using integrated authentication hence while debugging the access to the database is done using your credentials: as the developer you are likely allowed to do almost everything on the db so the application works correctly.
when the application is deployed the login to the database is performed using the credentials of the application pool used to run the application itself.
as a test you can change the user of the application pool on the iis server to use an account enabled on the db and retry to login.
there are two solutions:
- configure the application pool to use a specific windows user that is allowed to interact with the db
- change the connection string to log onto the db as a sql user (allowed to interact with the db)
I want to get the "offer-listing" using amazon API.
I have explored by myself but there is not clue to get it.
it would be nice if someone suggest me the API end point to get the offer-listing or alternative
You can either scrap the offering page or use the Amazon's Product's API and call:
GetLowestOfferListingsForSKU to get offer listing including your self(you can use $request->setExcludeMe(TRUE) to exclude your self)
GetMyPriceForSKU to get just your offer listing
This API calls will return Landing price,Shipping price,Listing price where Landing price is your selling price + shipping price. None of above API call includes seller's name or any identity, so if you'r after seller's name and selling price you better of scrapping the offering page.
Here is the code I used:
$asin amazon product's ASIN
$sku is amazon product's SKU
$pos_data array contains all Amazon API's credentials
$fba_check is 'Y' or 'N' whether the ASIN is FBA(Fulfilled by Amazon) or not
function init_pro_api($asin, $sku, $pos_data, $fba_check)
{
$try = 0;
while($try < 2)
{
$offers_list = "";
$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'];
$platform = $pos_data['azn_platform_variant'];
if($platform == "uk")
{
$serviceURL = "https://mws.amazonservices.co.uk/Products/2011-10-01";
}
else
$serviceURL = "https://mws-eu.amazonservices.com/Products/2011-10-01";
$DATE_FORMAT = "Y-m-d";
$config = array(
'ServiceURL' => $serviceURL,
'ProxyHost' => null,
'ProxyPort' => -1,
'MaxErrorRetry' => 3,
);
$service = new MarketplaceWebServiceProducts_Client($AWS_ACCESS_KEY_ID, $AWS_SECRET_ACCESS_KEY, $APPLICATION_NAME, $APPLICATION_VERSION, $config);
// Get My Price
$request = new MarketplaceWebServiceProducts_Model_GetMyPriceForSKURequest();
$request->setSellerId($MERCHANT_ID);
$request->setMarketplaceId($MARKETPLACE_ID);
$sku_list = new MarketplaceWebServiceProducts_Model_SellerSKUListType();
$sku_list->setSellerSKU($sku);
$request->setSellerSKUList($sku_list);
$my_offer = invokeGetMyPriceForSKU($service, $request, $fba_check);
// Get Other Sellers Lowest Offering Price
$request = new MarketplaceWebServiceProducts_Model_GetLowestOfferListingsForSKURequest();
$request->setSellerId($MERCHANT_ID);
$request->setMarketplaceId($MARKETPLACE_ID);
$request->setItemCondition("New");
$request->setExcludeMe(TRUE);
$sku_list = new MarketplaceWebServiceProducts_Model_SellerSKUListType();
$sku_list->setSellerSKU($sku);
$request->setSellerSKUList($sku_list);
$other_low_offers = invokeGetLowestOfferListingsForSKU($service, $request);
if($my_offer != "" or $my_offer != NULL)
{
$offers_list["MyOffer"] = $my_offer;
}
if($other_low_offers != "" or $other_low_offers != NULL)
{
$offers_list["OtherOffer"] = $other_low_offers;
}
if(isset($offers_list["OtherOffer"][0]))
if($offers_list["OtherOffer"][0] != "")
break;
$try++;
}
return $offers_list;
}
function invokeGetMyPriceForSKU(MarketplaceWebServiceProducts_Interface $service, $request, $fba_check)
{
try
{
$my_response_data = "";
$pre_check_xml_data = array();
$xml_feed_counter = 0;
$response = $service->GetMyPriceForSKU($request);
$dom = new DOMDocument();
$dom->loadXML($response->toXML());
$dom->preserveWhiteSpace = false;
$dom->formatOutput = true;
$xml_data = $dom->saveXML();
$doc = new DOMDocument;
$doc->preserveWhiteSpace = FALSE;
$doc->loadXML($xml_data);
$offer_length = $doc->getElementsByTagName('Offer')->length;
$fba_index = "";
$normal_index = "";
for($o = 0; $o < $offer_length; $o++)
{
$pre_check_xml_data[$o]["LandedPrice"] = $doc->getElementsByTagName('LandedPrice')->item($o)->lastChild->nodeValue;
$pre_check_xml_data[$o]["ListingPrice"] = $doc->getElementsByTagName('ListingPrice')->item($o)->lastChild->nodeValue;
$pre_check_xml_data[$o]["Shipping"] = $doc->getElementsByTagName('Shipping')->item($o)->lastChild->nodeValue;
$pre_check_xml_data[$o]["FulfillmentChannel"] = $doc->getElementsByTagName('FulfillmentChannel')->item($o)->nodeValue;
if($fba_check == "Y")
{
if($doc->getElementsByTagName('FulfillmentChannel')->item($o)->nodeValue == "AMAZON")
{
$fba_index = $o;
break;
}
}
elseif($fba_check == "N")
{
if($doc->getElementsByTagName('FulfillmentChannel')->item($o)->nodeValue == "MERCHANT")
{
$normal_index = $o;
break;
}
}
}
if($fba_check == "Y")
{
if($fba_index === "")
{
$my_response_data[0]["LandedPrice"] = "";
$my_response_data[0]["ListingPrice"] = "";
$my_response_data[0]["Shipping"] = "";
$my_response_data[0]["Fulfillment"] = "";
return $my_response_data;
}
else
{
$my_response_data[0] = $pre_check_xml_data[$fba_index];
return $my_response_data;
}
}
else
{
$my_response_data[0] = $pre_check_xml_data[$normal_index];
return $my_response_data;
}
}
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");
}
}
function invokeGetLowestOfferListingsForSKU(MarketplaceWebServiceProducts_Interface $service, $request)
{
try
{
$response_data = "";
$counter = 0;
$response = $service->getLowestOfferListingsForSKU($request);
$getLowestOfferListingsForSKUResultList = $response->getGetLowestOfferListingsForSKUResult();
foreach($getLowestOfferListingsForSKUResultList as $getLowestOfferListingsForSKUResult)
{
if($getLowestOfferListingsForSKUResult->isSetProduct())
{
$product = $getLowestOfferListingsForSKUResult->getProduct();
if($product->isSetLowestOfferListings())
{
$lowestOfferListings = $product->getLowestOfferListings();
$lowestOfferListingList = $lowestOfferListings->getLowestOfferListing();
foreach($lowestOfferListingList as $lowestOfferListing)
{
if($lowestOfferListing->isSetQualifiers())
{
$qualifiers = $lowestOfferListing->getQualifiers();
if($qualifiers->isSetFulfillmentChannel())
{
$response_data[$counter]["Fulfilled_By"] = $qualifiers->getFulfillmentChannel();
}
if($qualifiers->isSetShippingTime())
{
$shippingTime = $qualifiers->getShippingTime();
if($shippingTime->isSetMax())
{
$response_data[$counter]["ShippingTime"] = $shippingTime->getMax();
}
}
}
if($lowestOfferListing->isSetPrice())
{
$price1 = $lowestOfferListing->getPrice();
if($price1->isSetLandedPrice())
{
$landedPrice1 = $price1->getLandedPrice();
if($landedPrice1->isSetAmount())
{
$response_data[$counter]["LandedPrice"] = $landedPrice1->getAmount();
}
}
if($price1->isSetListingPrice())
{
$listingPrice1 = $price1->getListingPrice();
if($listingPrice1->isSetAmount())
{
$response_data[$counter]["ListingPrice"] = $listingPrice1->getAmount();
}
}
if($price1->isSetShipping())
{
$shipping1 = $price1->getShipping();
if($shipping1->isSetAmount())
{
$response_data[$counter]["Shipping"] = $shipping1->getAmount() . "\n";
}
}
}
$counter++;
}
}
}
if($getLowestOfferListingsForSKUResult->isSetError())
{
$error = $getLowestOfferListingsForSKUResult->getError();
if($error->isSetMessage())
{
$response_data = $error->getMessage() . "\n";
}
}
}
return $response_data;
}
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");
}
}
You can use the Amazon MWS products API like Keyur states. They provide PHP, C#, and Java example code and it's easy to work with.
If you want real-time price change notifications on products you are currently selling, subscribe to the AnyOfferChangedNotification notification. They have example code for that too. http://docs.developer.amazonservices.com/en_US/notifications/Notifications_AnyOfferChangedNotification.html
I'm doing some stuff with this right now and, if it helps anyone, I'm using the Advertising API and have found that if you make a request like this:
String requestString = "Service=AWSECommerceService"
+ "&Version=2009-03-31"
+ "&Operation=ItemLookup"
+ "&AssociateTag=some-associate-tag"
+ "&ItemId=" + your-item-id
+ "&ResponseGroup=BrowseNodes,OfferFull,ItemAttributes";
then you can look at the XPath //detailpageurl and you should get what you were expecting.