Forum Moderators: coopster

Message Too Old, No Replies

Warning: File get Content Error need help to fix it please anyone

         

starz342

5:16 am on Mar 22, 2010 (gmt 0)

10+ Year Member



Hi,

I have been trying to get this sorted but I am having no luck with this
certain page:

First I was getting this error message:

Warning: file_get_contents(http://ecs.amazonaws.com/onca/xml?Se...riationSummary) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request in /home/#*$!#*$!X/public_html/#*$!XX.com/#*$!XX/includes/amazon.php on line 847




Now I did try to change out this function:

on that line from this: file_get_contents

to this:fopen


but then I got this error message:

Warning: fopen() expects at least 2 parameters, 1 given in /home/#*$!XX/public_html/#*$!#*$!.com/#*$!XX/includes/amazon.php on line 847

Warning: Invalid argument supplied for foreach() in /home/#*$!#*$!/public_html/#*$!#*$!#*$!.com/#*$!#*$!X/includes/amazon.php on line 871



Please can someone help me to sort this out and tell me where I am going wrong
or what coding now needs to be changed in order to get this script page sorted please?

I thank you so very much and will await your much needed expert advice back into this error message, I am a newbie still learning all this PHP trying but not getting to far.

libby
libby3423 is online now Report Post

starz342

5:19 am on Mar 22, 2010 (gmt 0)

10+ Year Member



here is the file hope it takes
here is part of that code:

as I can not seem to get it to all go into here:

I will start it at the line the error message is on:

// Get the response from Amazon
$xml = file_get_contents($request);

// Parse the results
$Result = xmlparser($xml);}

//echo'<td width="160" valign="top" align="center">';

//content

echo'<table border="0" cellspacing="0" cellpadding="0" width="160"><tr>';

$Message=$Result['ItemSearchResponse']['Items'][0]['Request']['Errors']['Error'][0]['Message'];

if (isset($Message)) {
echo'<table width="160" border="0" cellpadding="8" cellspacing="0" align="center">
<tr><td align="left" class="errorClass">'.$Message.'</td></tr></table>';}
else {

$TotalPages=$Result['ItemSearchResponse']['Items'][0]['TotalPages'];

if ($TotalPages>100){$TotalPages=100;}

foreach ($Result['ItemSearchResponse']['Items'][0]['Item'] as $item) {

starz342

5:21 am on Mar 22, 2010 (gmt 0)

10+ Year Member



Hi again,

please forgive me if I am posting alot to this but I can not seem to get all the
code into here under one post:

so After I changed the code from: file_get_contents To this code:fopen on line
847 that is when got the above 2nd error message that I posted in my first post here.
Below is the code with the part I changed.
I sure hope that I have given enough info so that someone here can please be so kind as to help me sort this file out. thanks and I look forward to the reply back

libby

// Get the response from Amazon
$xml = fopen ($request);

//$xml = simplexml_load_file($request);

// Parse the results
$Result = xmlparser($xml);}

//echo'<td width="160" valign="top" align="center">';

//content

echo'<table border="0" cellspacing="0" cellpadding="0" width="160"><tr>';

$Message=$Result['ItemSearchResponse']['Items'][0]['Request']['Errors']['Error'][0]['Message'];

if (isset($Message)) {
echo'<table width="160" border="0" cellpadding="8" cellspacing="0" align="center">
<tr><td align="left" class="errorClass">'.$Message.'</td></tr></table>';}
else {

$TotalPages=$Result['ItemSearchResponse']['Items'][0]['TotalPages'];

if ($TotalPages>100){$TotalPages=100;}

foreach ($Result['ItemSearchResponse']['Items'][0]['Item'] as $item) {

Matthew1980

8:11 am on Mar 22, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi there Starz324,

The fopen(); function requires to parameter, 1)Filename to open (with path) 2)Mode of open (read/write etc).

So: $xml = fopen ($request, "W+"); //this will now open the file ref for reading and writing :)

And I hope that the $request is the correct path to the file you are trying to open.

Also, $Result = xmlparser($xml);}

You have a brace doing nothing there just needs to be:-

$Result = xmlparser($xml);

Try that for now, see if that makes a difference ;-p

Cheers,
MRb

Matthew1980

10:03 am on Mar 22, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi startz342,

Oh also, just checked that xmlparser(); is actually xml_parser();

MRb

starz342

10:39 pm on Mar 22, 2010 (gmt 0)

10+ Year Member



Hi Mathew 1980,

Thank you first off for the steps and the help with this issue. I followed your steps here, and it seems that it fixed that part of the code but now I have this new error message as follows:

Parse error: syntax error, unexpected $end in /home/#*$!XX/public_html/mysite.com/subdomain-name/includes/amazon.php on line 991

this is the only thing showing on this line
?>---- this is the only coding on this line.

Please can you be so kind as to further assist me with this issue?

Also I noticed that when I did your above fix my content went away on the site itself, but before I did your fix all the content was there but the first off error was there as well?

I hope I explained that right, and thank you so very much for taking the time out to help me with this issue I will await your next reply or if you cant assist then anyone else here that might be help to help again I would so appreciate it.

starz- Aka- Libby

Matthew1980

8:21 am on Mar 23, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi there starz342,

Uh-oh, never a good sign when you get that sort of error. Having said that though, it's sometimes an easy fix, look at the line, and see what is the last piece of code before the ?> and see if there is a missing }, infact try your original code: $Result = xml_parser($xml);} as this may have been a closing part from an opening brace :) Just a thought there.

The only reason I said to remove it was because I could see no evidence of an opening {, but then again, you may not have posted it :) Hope I make sense there..

Other than that it will more than likely be white space or a missing ; So make sure that the last lines read like:-

//some code here...
//last comment or something
?>

and not:-

//some code here...
//last comment or something


?>

As occasionally this can provoke an error.

If you want a more specific answer use error_reporting(E_ALL); at the top of your script, but make sure that you remove it when you go public with the script/site...

Well if the unexpected end error is there, the content will have gone, as the parser terminates the script, fix the error and hopefully all will be good [fingers crossed ;-p ]

Good luck ;-p

MRb

starz342

5:09 pm on Mar 23, 2010 (gmt 0)

10+ Year Member



Hi Once Again Mathew,

first off thank you once again for the reply back to this thread, appreciate it.

I did try your advice but got no where:(

Ok so I reread your first reply and got to checking out to see if this was the issue:
you had said:And I hope that the $request is the correct path to the file you are trying to open.


So I tried that request on its own ( copied it and stuck it into my webrowser) and it lead me here when I put it into the URL:

here is that URL link:
[xml.amazon.com...]


So I am going to copy out my whole PHP code here from this file with the alterations that I tried to put into it and caused a complete mess of to see if you can please please be so kind as to further assist me with this issue:

I will put "#*$!XX" where my personal info is so as not to break any forum rules here ok.


Here are the lines I edited:

lines: 6,7, 10, 31, 514, 834, 844, 847, 853

So please please can you take a look at this coding
and tell me where I am going wrong here?

When I tried once more to follow your steps it put me back to the first set of error codes, then when tried once more it started giving this new error message:
Parse error: syntax error, unexpected T_STRING

so as you can see I am a complete newbie to this php coding and editing and getting no where and wasting so many hours and days here thus far trying to get this to work. Mind you the script did use to work so again I got to rechecking and maybe it is just something in the new updated amazon coding itself which I am missing?

thanks mathew once more, It seems I am going to have to post the code into 2 seperate post threads here or maybe even 3 to get all the code in, I sure hope it does not break the coding itself up by doing this method but I feel it is the only way to get all the coding into here I will post the line I start on and end on as well so that it can be copied and looked at.

starz- libby

starz342

5:10 pm on Mar 23, 2010 (gmt 0)

10+ Year Member



ok here is first part:

line 1 - 239:

<?php

// amazon ecs free affiliate script v3.2.0
// script by pagerank10.co.uk copyright 2006

//define ('AssociateId', '#*$!#*$!#*$!XX-#*$!');
//define ('AWSAccessKeyId', '#*$!#*$!#*$!#*$!#*$!#*$!#*$!#*$!X');

define ('AWSAccessKeyId', '#*$!#*$!#*$!#*$!#*$!#*$!#*$!XX'); // if you do not have a subscription Id do not edit
define ('Version', '2010-03-22');
//define ('CountryId', 'com'); // options 'co.uk' (UK) 'fr' (FRANCE) 'de' (GERMANY) 'com' (US) 'ca' (CANADA)

//options "URL" "CURL" (only change if your server does not support HTTP URL REQUESTS
$httpRequest="URL";

define ('NOIMAGE', 'style/img/no-image-small.gif');
define ('NOIMAGE_MED', 'style/img/no-image-med.gif');
define ('Columns', '1');
define ('BgColor', '#ffffff');

////////////////////////////////////////////////////////////////////////

if ($Aassociates_id['us'] != 'INVALID') {
define ('CountryId', 'com');
define ('AssociateId', $Aassociates_id['us']);
} elseif ($Aassociates_id['uk'] != 'INVALID') {
define ('CountryId', 'co.uk');
define ('AssociateId', $Aassociates_id['uk']);
} else {
define ('CountryId', 'co.uk');
define ('AssociateId', '#*$!#*$!#*$!-#*$!XX');
}

if (empty($amazonkeyword)) {
$search=$mainkeyword;
} else {
$search=$amazonkeyword;
}
if (empty($search)) {
$search=$_REQUEST['search'];
$search=trim(str_replace('"','',$search));
}
if (empty($search)) { $search = "pet care"; }

$maxresult=$num_amazon;
if (empty($maxresult)) {
$maxresult=$_REQUEST['max'];
}
if (empty($maxresult)) { $maxresult = "5"; }
if ($maxresult > 10) { $maxresult = "10"; }

$searchIndex=$_REQUEST['searchIndex'];
$searchIndex=trim(str_replace('"','',$searchIndex));
if (empty($searchIndex)){ $searchIndex="Books"; }

$cat1=$_REQUEST['cat1'];
$sort=$_REQUEST['sort'];

$page=$_REQUEST['page'];
if ($page==''){$page=1;}


/////////////////////////////////////////////////////////////////////////

// setup.php

switch (CountryId) {


case "co.uk";

///////////////////////////amazon.co.uk setup///////////////////////////////////



$titleTag=""; // optional enter a phrase to be used in the title tag

// format for custom page array - $custom_page=array("filename.php" => "menuname","filename.php" => "menuname","filename.php" => "menuname")
$custom_page=array("customPage.php" => "Custom Page");


// ASIN'S and Category1 browsnodes for Featured Products - Max 10 products
// Enter a product ASIN followed by the category1 browsenode for that product
// Category1 browsenodes can be found in category.php or in your browser when you select a main category - eg. cat1=266239
$FeaturedProducts=array("1846051614" => "266239","B0001NE2AK" => "468292","B000JK8OYU" => "694208","B000HZBQ42" => "560798");
// end Featured Products


// language co.uk
define ('LangAccessories', 'Accessories');
define ('LangAudienceRating', 'Audience Rating');
define ('LangAvailability', 'Availability');
define ('LangAverageFeedbackRating', 'Average Feedback Rating');
define ('LangAverageRating', 'Average Rating');
define ('LangBookmark', 'Bookmark');
define ('LangBy', 'by');
define ('LangCategories', 'Categories');
define ('LangComments', 'Comments');
define ('LangCondition', 'Condition');
define ('LangCurrency', '&pound; ');
define ('LangCustomerReviews', 'Customer Reviews');
define ('LangDirectedBy', 'Directed By');
define ('LangDisc', 'Disc');
define ('LangFeaturedProducts', 'Featured Products');
define ('LangFormat', 'Format');
define ('LangFrom', 'from');
define ('LangHome', 'Home');
define ('LangListPrice', 'List Price: ');
define ('LangLocation', 'Location');
define ('LangMedia', 'Media');
define ('LangMenu', 'amazon.co.uk');
define ('LangMinimumAge', 'Minimum Age');
define ('LangNewAndUsed', "Used");
define ('LangOrderBox', 'Ready to Order');
define ('LangOutOfStock', 'Currently out of stock');
define ('LangPage', 'Page');
define ('LangPlatform', 'Platform');
define ('LangPrice', 'Our Price: ');
define ('LangProductDetails', 'Product Details');
define ('LangProductGroup', 'Product Group');
define ('LangPublicationDate', 'Publication Date');
define ('LangQuantity', 'Qty');
define ('LangRating', 'Rating');
define ('LangReleaseDate', 'Release Date');
define ('LangSalesRank', 'Sales Rank');
define ('LangSeller', 'Seller');
define ('LangSellerPrice', 'Price');
define ('LangSimilarProducts', 'Similar Products');
define ('LangStarring', 'starring');
define ('LangTotalFeedback', 'Total Feedback');
define ('LangViewBasket', 'View Cart/Checkout');

define ('LangFeaturedItems', 'Featured items');
define ('LangNewestArrivals', 'Newest arrivals');
define ('LangOnSale', 'On sale');
define ('LangAgeLowToHigh', 'Age: low to high');
define ('LangAgeHighToLow', 'Age: high to low');
define ('LangBestSelling', 'Best Selling');
define ('LangAverageCustomerReviewHighToLow', 'Average customer review: high to low');
define ('LangPriceLowToHigh', 'Price: low to high');
define ('LangPriceHighToLow', 'Price: high to low');
define ('LangPublicationDateNewToOld', 'Publication date: new to old');
define ('LangPublicationDateOldToNew', 'Publication date: old to new');
define ('LangAlphabeticalAToZ', 'Alphabetical: A to Z');
define ('LangAlphabeticalZToA', 'Alphabetical: Z to A');
define ('LangReleaseDateNewToOld', 'Release Date: new to old');
define ('LangReleaseDateOldToNew', 'Release Date: old to new');
define ('LangImportedItemsFirst', 'Imported Items First');
define ('LangCustomPages', 'Custom Pages'); // leave blank '' to de-activate custom pages or enter a phrase to activate
//end language co.uk


/////////////////////////end amazon.co.uk///////////////////////////////////////

break;

case "de":


//////////////////////amazon.de setup///////////////////////////////////////////


$titleTag=""; // optional enter a phrase to be used in the title tag

// format for custom page array - $custom_page=array("filename.php" => "menuname","filename.php" => "menuname","filename.php" => "menuname")
$custom_page=array("customPage.php" => "Custom Page");


// ASIN'S and Category1 browsnodes for Featured Products - Max 10 products
// Enter a product ASIN followed by the category1 browsenode for that product
// Category1 browsenodes can be found in category.php or in your browser when you select a main category - eg. cat1=266239
$FeaturedProducts=array("B000LR6DVW" => "541686", "B000HEZG0S" => "562066", "B000KCI73A" => "542676", "B000BOIXWC" => "541708");
// end Featured Products


// language de
define ('LangAccessories', 'Zusatzgerate');
define ('LangAudienceRating', 'FSK');
define ('LangAvailability', 'Verwendbarkeit');
define ('LangAverageFeedbackRating', 'Bewertung');
define ('LangAverageRating', 'Durchschnittliche Bewertung');
define ('LangBookmark', 'Bookmark');
define ('LangBy', 'von');
define ('LangCategories', 'Kategorien');
define ('LangComments', 'Kommentiert');
define ('LangCondition', 'Zustand');
define ('LangCurrency', 'EUR ');
define ('LangCustomerReviews', 'Kundenrezensionen');
define ('LangDirectedBy', 'Regisseur');
define ('LangDisc', 'Disc');
define ('LangFeaturedProducts', 'Gekennzeichnete Produkte');
define ('LangFormat', 'Format');
define ('LangFrom', 'ab');
define ('LangHome', 'Haupt');
define ('LangListPrice', 'Listenpreis: ');
define ('LangLocation', 'Position:');
define ('LangMedia', 'Mittel');
define ('LangMenu', 'amazon.de');
define ('LangMinimumAge', 'Minimales Alter');
define ('LangNewAndUsed', "Gebraucht");
define ('LangOrderBox', 'Vorbereiten, um zu bestellen');
define ('LangOutOfStock', 'Currently out of stock');
define ('LangPage', 'Seite');
define ('LangPlatform', 'Plattformen');
define ('LangPrice', 'Preis: ');
define ('LangProductDetails', 'Produktdetails');
define ('LangProductGroup', 'Produkt-Gruppe');
define ('LangPublicationDate', 'Publikation Datum');
define ('LangQuantity', 'Qty');
define ('LangRating', 'Bewertung');
define ('LangReleaseDate', 'Erscheinungsdatum');
define ('LangSalesRank', 'Verkaufe Rank');
define ('LangSeller', 'Verkaufer');
define ('LangSellerPrice', 'Preis');
define ('LangSimilarProducts', 'Ahnliche Zusatzgerate');
define ('LangStarring', 'Darsteller');
define ('LangTotalFeedback', 'Insgesamt Bewertung');
define ('LangViewBasket', 'Einkaufswagen');

define ('LangFeaturedItems', 'Featured items');
define ('LangNewestArrivals', 'Newest arrivals');
define ('LangOnSale', 'On sale');
define ('LangAgeLowToHigh', 'Age: low to high');
define ('LangAgeHighToLow', 'Age: high to low');
define ('LangBestSelling', 'Beste Ergebnisse');
define ('LangAverageCustomerReviewHighToLow', 'Durchschnittliche Kundenbewertung');
define ('LangPriceLowToHigh', 'Preis: aufsteigend');
define ('LangPriceHighToLow', 'Preis: absteigend');
define ('LangPublicationDateNewToOld', 'Erscheinungsdatum: neu bis alter');
define ('LangPublicationDateOldToNew', 'Erscheinungsdatum: alter bis neu');
define ('LangAlphabeticalAToZ', 'Alphabet: A bis Z');
define ('LangAlphabeticalZToA', 'Alphabet: Z bis A');
define ('LangReleaseDateNewToOld', 'Erscheinungsdatum: neu bis alter');
define ('LangReleaseDateOldToNew', 'Erscheinungsdatum: alter bis neu');
define ('LangImportedItemsFirst', 'Importe');
define ('LangCustomPages', 'Custom Pages'); // leave blank '' to de-activate custom pages or enter a phrase to activate
//end language de

////////////////////////////////end amazon.de///////////////////////////////////

starz342

5:12 pm on Mar 23, 2010 (gmt 0)

10+ Year Member



line 240- to line 639

<?php

// amazon ecs free affiliate script v3.2.0
// script by pagerank10.co.uk copyright 2006

//define ('AssociateId', '#*$!#*$!#*$!XX-#*$!');
//define ('AWSAccessKeyId', '#*$!#*$!#*$!#*$!#*$!#*$!#*$!#*$!X');

define ('AWSAccessKeyId', '#*$!#*$!#*$!#*$!#*$!#*$!#*$!XX'); // if you do not have a subscription Id do not edit
define ('Version', '2010-03-22');
//define ('CountryId', 'com'); // options 'co.uk' (UK) 'fr' (FRANCE) 'de' (GERMANY) 'com' (US) 'ca' (CANADA)

//options "URL" "CURL" (only change if your server does not support HTTP URL REQUESTS
$httpRequest="URL";

define ('NOIMAGE', 'style/img/no-image-small.gif');
define ('NOIMAGE_MED', 'style/img/no-image-med.gif');
define ('Columns', '1');
define ('BgColor', '#ffffff');

////////////////////////////////////////////////////////////////////////

if ($Aassociates_id['us'] != 'INVALID') {
define ('CountryId', 'com');
define ('AssociateId', $Aassociates_id['us']);
} elseif ($Aassociates_id['uk'] != 'INVALID') {
define ('CountryId', 'co.uk');
define ('AssociateId', $Aassociates_id['uk']);
} else {
define ('CountryId', 'co.uk');
define ('AssociateId', '#*$!#*$!#*$!-#*$!XX');
}

if (empty($amazonkeyword)) {
$search=$mainkeyword;
} else {
$search=$amazonkeyword;
}
if (empty($search)) {
$search=$_REQUEST['search'];
$search=trim(str_replace('"','',$search));
}
if (empty($search)) { $search = "pet care"; }

$maxresult=$num_amazon;
if (empty($maxresult)) {
$maxresult=$_REQUEST['max'];
}
if (empty($maxresult)) { $maxresult = "5"; }
if ($maxresult > 10) { $maxresult = "10"; }

$searchIndex=$_REQUEST['searchIndex'];
$searchIndex=trim(str_replace('"','',$searchIndex));
if (empty($searchIndex)){ $searchIndex="Books"; }

$cat1=$_REQUEST['cat1'];
$sort=$_REQUEST['sort'];

$page=$_REQUEST['page'];
if ($page==''){$page=1;}


/////////////////////////////////////////////////////////////////////////

// setup.php

switch (CountryId) {


case "co.uk";

///////////////////////////amazon.co.uk setup///////////////////////////////////



$titleTag=""; // optional enter a phrase to be used in the title tag

// format for custom page array - $custom_page=array("filename.php" => "menuname","filename.php" => "menuname","filename.php" => "menuname")
$custom_page=array("customPage.php" => "Custom Page");


// ASIN'S and Category1 browsnodes for Featured Products - Max 10 products
// Enter a product ASIN followed by the category1 browsenode for that product
// Category1 browsenodes can be found in category.php or in your browser when you select a main category - eg. cat1=266239
$FeaturedProducts=array("1846051614" => "266239","B0001NE2AK" => "468292","B000JK8OYU" => "694208","B000HZBQ42" => "560798");
// end Featured Products


// language co.uk
define ('LangAccessories', 'Accessories');
define ('LangAudienceRating', 'Audience Rating');
define ('LangAvailability', 'Availability');
define ('LangAverageFeedbackRating', 'Average Feedback Rating');
define ('LangAverageRating', 'Average Rating');
define ('LangBookmark', 'Bookmark');
define ('LangBy', 'by');
define ('LangCategories', 'Categories');
define ('LangComments', 'Comments');
define ('LangCondition', 'Condition');
define ('LangCurrency', '&pound; ');
define ('LangCustomerReviews', 'Customer Reviews');
define ('LangDirectedBy', 'Directed By');
define ('LangDisc', 'Disc');
define ('LangFeaturedProducts', 'Featured Products');
define ('LangFormat', 'Format');
define ('LangFrom', 'from');
define ('LangHome', 'Home');
define ('LangListPrice', 'List Price: ');
define ('LangLocation', 'Location');
define ('LangMedia', 'Media');
define ('LangMenu', 'amazon.co.uk');
define ('LangMinimumAge', 'Minimum Age');
define ('LangNewAndUsed', "Used");
define ('LangOrderBox', 'Ready to Order');
define ('LangOutOfStock', 'Currently out of stock');
define ('LangPage', 'Page');
define ('LangPlatform', 'Platform');
define ('LangPrice', 'Our Price: ');
define ('LangProductDetails', 'Product Details');
define ('LangProductGroup', 'Product Group');
define ('LangPublicationDate', 'Publication Date');
define ('LangQuantity', 'Qty');
define ('LangRating', 'Rating');
define ('LangReleaseDate', 'Release Date');
define ('LangSalesRank', 'Sales Rank');
define ('LangSeller', 'Seller');
define ('LangSellerPrice', 'Price');
define ('LangSimilarProducts', 'Similar Products');
define ('LangStarring', 'starring');
define ('LangTotalFeedback', 'Total Feedback');
define ('LangViewBasket', 'View Cart/Checkout');

define ('LangFeaturedItems', 'Featured items');
define ('LangNewestArrivals', 'Newest arrivals');
define ('LangOnSale', 'On sale');
define ('LangAgeLowToHigh', 'Age: low to high');
define ('LangAgeHighToLow', 'Age: high to low');
define ('LangBestSelling', 'Best Selling');
define ('LangAverageCustomerReviewHighToLow', 'Average customer review: high to low');
define ('LangPriceLowToHigh', 'Price: low to high');
define ('LangPriceHighToLow', 'Price: high to low');
define ('LangPublicationDateNewToOld', 'Publication date: new to old');
define ('LangPublicationDateOldToNew', 'Publication date: old to new');
define ('LangAlphabeticalAToZ', 'Alphabetical: A to Z');
define ('LangAlphabeticalZToA', 'Alphabetical: Z to A');
define ('LangReleaseDateNewToOld', 'Release Date: new to old');
define ('LangReleaseDateOldToNew', 'Release Date: old to new');
define ('LangImportedItemsFirst', 'Imported Items First');
define ('LangCustomPages', 'Custom Pages'); // leave blank '' to de-activate custom pages or enter a phrase to activate
//end language co.uk


/////////////////////////end amazon.co.uk///////////////////////////////////////

break;

case "de":


//////////////////////amazon.de setup///////////////////////////////////////////


$titleTag=""; // optional enter a phrase to be used in the title tag

// format for custom page array - $custom_page=array("filename.php" => "menuname","filename.php" => "menuname","filename.php" => "menuname")
$custom_page=array("customPage.php" => "Custom Page");


// ASIN'S and Category1 browsnodes for Featured Products - Max 10 products
// Enter a product ASIN followed by the category1 browsenode for that product
// Category1 browsenodes can be found in category.php or in your browser when you select a main category - eg. cat1=266239
$FeaturedProducts=array("B000LR6DVW" => "541686", "B000HEZG0S" => "562066", "B000KCI73A" => "542676", "B000BOIXWC" => "541708");
// end Featured Products


// language de
define ('LangAccessories', 'Zusatzgerate');
define ('LangAudienceRating', 'FSK');
define ('LangAvailability', 'Verwendbarkeit');
define ('LangAverageFeedbackRating', 'Bewertung');
define ('LangAverageRating', 'Durchschnittliche Bewertung');
define ('LangBookmark', 'Bookmark');
define ('LangBy', 'von');
define ('LangCategories', 'Kategorien');
define ('LangComments', 'Kommentiert');
define ('LangCondition', 'Zustand');
define ('LangCurrency', 'EUR ');
define ('LangCustomerReviews', 'Kundenrezensionen');
define ('LangDirectedBy', 'Regisseur');
define ('LangDisc', 'Disc');
define ('LangFeaturedProducts', 'Gekennzeichnete Produkte');
define ('LangFormat', 'Format');
define ('LangFrom', 'ab');
define ('LangHome', 'Haupt');
define ('LangListPrice', 'Listenpreis: ');
define ('LangLocation', 'Position:');
define ('LangMedia', 'Mittel');
define ('LangMenu', 'amazon.de');
define ('LangMinimumAge', 'Minimales Alter');
define ('LangNewAndUsed', "Gebraucht");
define ('LangOrderBox', 'Vorbereiten, um zu bestellen');
define ('LangOutOfStock', 'Currently out of stock');
define ('LangPage', 'Seite');
define ('LangPlatform', 'Plattformen');
define ('LangPrice', 'Preis: ');
define ('LangProductDetails', 'Produktdetails');
define ('LangProductGroup', 'Produkt-Gruppe');
define ('LangPublicationDate', 'Publikation Datum');
define ('LangQuantity', 'Qty');
define ('LangRating', 'Bewertung');
define ('LangReleaseDate', 'Erscheinungsdatum');
define ('LangSalesRank', 'Verkaufe Rank');
define ('LangSeller', 'Verkaufer');
define ('LangSellerPrice', 'Preis');
define ('LangSimilarProducts', 'Ahnliche Zusatzgerate');
define ('LangStarring', 'Darsteller');
define ('LangTotalFeedback', 'Insgesamt Bewertung');
define ('LangViewBasket', 'Einkaufswagen');

define ('LangFeaturedItems', 'Featured items');
define ('LangNewestArrivals', 'Newest arrivals');
define ('LangOnSale', 'On sale');
define ('LangAgeLowToHigh', 'Age: low to high');
define ('LangAgeHighToLow', 'Age: high to low');
define ('LangBestSelling', 'Beste Ergebnisse');
define ('LangAverageCustomerReviewHighToLow', 'Durchschnittliche Kundenbewertung');
define ('LangPriceLowToHigh', 'Preis: aufsteigend');
define ('LangPriceHighToLow', 'Preis: absteigend');
define ('LangPublicationDateNewToOld', 'Erscheinungsdatum: neu bis alter');
define ('LangPublicationDateOldToNew', 'Erscheinungsdatum: alter bis neu');
define ('LangAlphabeticalAToZ', 'Alphabet: A bis Z');
define ('LangAlphabeticalZToA', 'Alphabet: Z bis A');
define ('LangReleaseDateNewToOld', 'Erscheinungsdatum: neu bis alter');
define ('LangReleaseDateOldToNew', 'Erscheinungsdatum: alter bis neu');
define ('LangImportedItemsFirst', 'Importe');
define ('LangCustomPages', 'Custom Pages'); // leave blank '' to de-activate custom pages or enter a phrase to activate
//end language de

////////////////////////////////end amazon.de///////////////////////////////////

starz342

5:14 pm on Mar 23, 2010 (gmt 0)

10+ Year Member



lines 640-990:

this is the ending part of the code:



switch (CountryId) {


case "co.uk":

//////////////////////////////amazon.co.uk category list/////////////////////////////////////

// cat1
//format "Amazon SearchIndex name:Name to appear in cat1 menu" => "cat1 BrowseNode:cat1 or cat2 browsenode (search this category only)
$category1_list=array("Books:Books" => "266239:266239",
"Electronics:Electronics" => "560798:560798",
"Music:Music" => "694208:694208",
"DVD:DVD" => "283926:283926",
"VHS:VHS" => "573398:573398",
"Software:Software" => "300435:300435",
"VideoGames:PC & Video Games" => "300703:300703",
"Kitchen:Kitchen" => "11052681:11052681",
"HealthPersonalCare:Health & Personal Care" => "11052661:11052661",
"OutdoorLiving:Outdoor Living" => "11052671:11052671",
"Toys:Toys & Games" => "468292:468292");
// end cat1




//////////////////////////////end amazon.co.uk//////////////////////////////////

break;


case "de":

/////////////////////////////amazon.de category list//////////////////////////////////////////

// cat1
//format "Amazon SearchIndex name:Name to appear in cat1 menu" => "cat1 BrowseNode:cat1 or cat2 browsenode (search this category only)
$category1_list=array("Books:Bucher" => "541686:541686",
"Electronics:Elektronik & Foto" => "562066:562066",
"Music:Musik" => "542676:542676",
"DVD:DVD" => "284266:284266",
"VHS:VHS" => "547082:547082",
"Software:Software" => "542064:542064",
"VideoGames:Games" => "541708:541708",
"Kitchen:Kuche & Haushalt" => "3167641:3167641",
"HealthPersonalCare:Korperpflege & Bad" => "10925041:10925041",
"OutdoorLiving:Garten & Freizeit" => "10925031:10925031",
"Tools:Heimwerken" => "10925051:10925051",
"Toys:Spielwaren & Kinderwelt" => "12950651:12950651",
"SportingGoods:Sport & Freizeit" => "16435051:16435051");
// end cat1




/////////////////////////////end amazon.de//////////////////////////////////////

break;


case "fr":

///////////////////////////amazon.fr category list////////////////////////////////////////////

// cat1
//format "Amazon SearchIndex name:Name to appear in cat1 menu" => "cat1 BrowseNode:cat1 or cat2 browsenode (search this category only)
$category1_list=array("Books:Livres" => "301061:301061",
"Electronics:Image & Son Micro & Photo" => "13921051:13921051",
"Music:Musique" => "301062:301062",
"DVD:DVD" => "405322:405322",
"VHS:Video" => "301063:301063",
"Software:Logiciels" => "530488:530488",
"VideoGames:Jeux Video" => "530490:530490");
// end cat1




//////////////////////////end amazon.fr/////////////////////////////////////////

break;

case "com";

//////////////////////////////amazon.com category list/////////////////////////////////////

// cat1
//format "Amazon SearchIndex name:Name to appear in cat1 menu" => "cat1 BrowseNode:cat1 or cat2 browsenode (search this category only)
$category1_list=array("Apparel:Apparel" => "1036682:1036682",
"Baby:Baby" => "165796011:165796011",
"Beauty:Beauty" => "3760911:3760911",
"Books:Books" => "1000:1000",
"DVD:DVD" => "130:130",
"Electronics:Electronics" => "172282:172282",
"GourmetFood:Gourmet Food" => "3370831:3370831",
"HealthPersonalCare:Health & Personal Care" => "3760901:3760901",
"Jewelry:Jewelry" => "3367581:3367581",
"Kitchen:Kitchen" => "284507:284507",
"Music:Music" => "301668:301668",
"MusicalInstruments:Musical Instruments" => "11091801:11091801",
"OfficeProducts:Office Products" => "1064954:1064954",
"OutdoorLiving:Outdoor Living" => "286168:286168",
"PCHardware:PC Hardware" => "541966:541966",
"PetSupplies:Pet Supplies" => "12923371:12923371",
"Photo:Photo" => "502394:502394",
"Software:Software" => "229534:229534",
"SportingGoods:Sports & Outdoors" => "3375251:3375251",
"Tools:Tools" => "228013:228013",
"Toys:Toys" => "165795011:165795011",
"VHS:VHS" => "404272:404272",
"VideoGames:PC & Video Games" => "468642:468642");


// end cat1




///////////////////////////////end amazon.com///////////////////////////////////

break;


case "ca":

///////////////////////////amazon.ca category list////////////////////////////////////////////

// cat1
//format "Amazon SearchIndex name:Name to appear in cat1 menu" => "cat1 BrowseNode:cat1 or cat2 browsenode (search this category only)
$category1_list=array("Books:Books" => "916520:916520",
"Music:Music" => "916514:916514",
"DVD:DVD" => "952768:952768",
"VHS:VHS" => "916518:916518",
"Software:Software" => "3198021:3198021",
"VideoGames:PC & Video Games" => "3198031:3198031");
// end cat1




//////////////////////////end amazon.ca/////////////////////////////////////////

break;


}


// search.php


$i=1;

/*

echo '<html><head>';

echo'<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="stylesheet.css">';

?>

</head>

<body bgcolor="#009900">

*/

//echo '<table border="0" cellspacing="0" cellpadding="0" width="160" align="left">';

foreach ($category1_list as $key => $value) {

$key = explode(":", $key);
$value = explode(":", $value);
$query_string = 'productList.php?cat1=' . urlencode($value[0]) . '&node=' . $value[1].'';

if ($cat1==$value[0]){
$cat1_name_selected=$key[1];
$searchIndex=$key[0];
$searchNode=$value[1];
$cat1_node_selected=$value[0];
}}

//end left content

//echo'<tr>';

// echo'<title>'.$titleTag.' '.$cat1_name_selected.' '.$search.'</title>';


if ($httpRequest=="CURL"){

$ch = curl_init();
$timeout = 0; // set to zero for no timeout
curl_setopt ($ch, CURLOPT_URL, 'http://ecs.amazonaws.'.CountryId.'/onca/xml?Service=AWSECommerceService&Version='.Version.'&Operation=ItemSearch&ContentType=text%2Fxml&AWSAccessKeyId='.KeyId.'&AssociateTag='.AssociateId.'&SearchIndex='.$searchIndex.'&BrowseNode='.$searchNode.'&Keywords='.urlencode($search).'&ItemPage='.$page.'&Sort='.$sort.'&ResponseGroup=Images,ItemAttributes,OfferFull,Medium,VariationSummary');
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$xml = curl_exec($ch);
curl_close($ch);

$Result = xmlparser($xml);}

else {

$request='http://ecs.amazonaws.'.CountryId.'/onca/xml?Service=AWSECommerceService&Version='.Version.'&Operation=ItemSearch&ContentType=text%2Fxml&AWSAccessKeyId='.KeyId.'&AssociateTag='.AssociateId.'&SearchIndex='.$searchIndex.'&BrowseNode='.$searchNode.'&Keywords='.urlencode($search).'&ItemPage='.$page.'&Sort='.$sort.'&ResponseGroup=Images,ItemAttributes,OfferFull,Medium,VariationSummary';


// Get the response from Amazon
$xml = fopen ($request, "W+");

//$xml = simplexml_load_file($request);

// Parse the results
$Result = xml_parser($xml);}

//echo'<td width="160" valign="top" align="center">';

//content

echo'<table border="0" cellspacing="0" cellpadding="0" width="160"><tr>';

$Message=$Result['ItemSearchResponse']['Items'][0]['Request']['Errors']['Error'][0]['Message'];

if (isset($Message)) {
echo'<table width="160" border="0" cellpadding="8" cellspacing="0" align="center">
<tr><td align="left" class="errorClass">'.$Message.'</td></tr></table>';}
else {

$TotalPages=$Result['ItemSearchResponse']['Items'][0]['TotalPages'];

if ($TotalPages>100){$TotalPages=100;}

foreach ($Result['ItemSearchResponse']['Items'][0]['Item'] as $item) {

if ($i <= $maxresult) {

if (isset($item['MediumImage']['URL'])) {
$MediumImage=$item["MediumImage"]["URL"];
} else {
$MediumImage=NOIMAGE;
}

$r=0;
$Author=array();
while (isset($item["ItemAttributes"]["Author"][$r])){
$Author[$r] = $item["ItemAttributes"]["Author"][$r];
$r++;}

$r=0;

while (isset($item["ItemAttributes"]["Platform"][$r])){
$Platform[$r] = $item["ItemAttributes"]["Platform"][$r];
$r++;}

$r=0;
$Artist=array();
while (isset($item["ItemAttributes"]["Artist"][$r])){
$Artist[$r] = $item["ItemAttributes"]["Artist"][$r];
$r++;}

$r=0;
while (isset($item["ItemAttributes"]["Platform"][$r])){
$Platform[$r] = $item["ItemAttributes"]["Platform"][$r];
$r++;}

$Title=$item["ItemAttributes"]["Title"];
$DetailPageURL=$item["DetailPageURL"];
$ASIN=$item["ASIN"][0];
$Actor=$item["ItemAttributes"]["Actor"][0];
$Manufacturer=$item["ItemAttributes"]["Manufacturer"];
$TotalNew=$item["OfferSummary"]["TotalNew"];
$TotalUsed=$item["OfferSummary"]["TotalUsed"];
$TotalCollectible=$item["OfferSummary"]["TotalCollectible"];
$TotalRefurbished=$item["OfferSummary"]["TotalRefurbished"];
$ListPrice=$item["ItemAttributes"]["ListPrice"]["FormattedPrice"];
$LowestNewPrice=$item["OfferSummary"]["LowestNewPrice"]["Amount"];
$LowestUsedPrice=$item["OfferSummary"]["LowestUsedPrice"]["Amount"];
$LowestCollectiblePrice=$item["OfferSummary"]["LowestCollectiblePrice"]["Amount"];
$LowestRefurbishedPrice=$item["OfferSummary"]["LowestRefurbishedPrice"]["Amount"];
$Price=$item['Offers']['Offer'][0]['OfferListing'][0]['Price']['FormattedPrice'];
$VariationPriceLow=$item["VariationSummary"]["LowestPrice"]["FormattedPrice"];
$VariationPriceHigh=$item["VariationSummary"]["HighestPrice"]["FormattedPrice"];

echo'<td align="left" valign="top" class="prodListB">
<table width="160" cellspacing="4" cellpadding="0" align="center">
<tr><td width="160" valign="top" align="center">

<a href="'.$DetailPageURL.'" target="_blank"><img src="'.$MediumImage.'" border="0" width="100" alt="'.$Title.'"></a><br>

<a href="'.$DetailPageURL.'" target="_blank">'.$Title.'</a>
<br>';

if (sizeof($Artist)>0){
echo'<span style="font-size: 10px">'.LangBy.' </span>';
foreach ($Artist as $value) {
echo ' '.$value.' ';}}

if (sizeof($Author)>0){
echo'<span style="font-size: 10px">'.LangBy.' </span>';
foreach ($Author as $value) {
echo ' '.$value.' ';}}

if (isset($Actor)){
echo'<span style="font-size: 10px">'.LangStarring.' </span>';{
echo' '.$Actor.' ';}}

if (sizeof($Platform)>0){
echo'<br><b>'.LangPlatform.':</b>';
foreach ($Platform as $value) {
echo' '. $value.'';}}

if ($Price>""){echo'<br><span style="color: black; font-weight: bold">'.LangPrice.'</span><span style="color: red; font-weight: bold">'.$Price.'</span>'; }

if ($VariationPriceLow){echo'<br><span style="color: black; font-weight: bold">'.LangPrice.'</span><span style="color: red; font-weight: bold">'.$VariationPriceLow.'</span>'; }
if ($VariationPriceHigh>$VariationPriceLow){echo' - <span style="color: red; font-weight: bold">'.$VariationPriceHigh.'</span>';}

$LowestPrices=array($LowestNewPrice,$LowestUsedPrice,$LowestCollectiblePrice,$LowestRefurbishedPrice);
$LowestPrices=array_unique($LowestPrices);
sort($LowestPrices);
$TotalNewandUsed=($TotalNew+$TotalUsed+$TotalCollectible+$TotalRefurbished);
if ($TotalNewandUsed>0) {
if ($LowestPrices[0]>""){
$LowestPrice=''.LangCurrency.''.number_format($LowestPrices[0]/100,2);} else {$LowestPrice=''.LangCurrency.''.number_format($LowestPrices[1]/100,2);}
echo'<br><a href="'.$DetailPageURL.'" target="_blank">'.LangNewAndUsed.'</a> '.LangFrom.': '.$LowestPrice.'<br><br>';
}


//if ($Price or $VariationPriceLow){

echo'</td></tr></table>';

/*
} else {
echo'</td></tr></table>';
}
*/

if ($i % Columns==0){

echo'</tr><tr>'; }
else
{
echo'<td width="4"></td>';
}
$i++;
}}

echo '<td></td></tr></table>';

}
?>

Matthew1980

7:48 pm on Mar 23, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi there starz342,

Thank you for posting the whole code - unexpected but at least I can grasp what's going on, well at least the idea anyway, I cannot promise a fix, just advice.

The link that you posted, as it's not to a personal site, the moderators shouldn't erase it, it leads to a generic message stating that the web service was deprecated in 2008, so are you sure that this is where the xml is being opened from?

as for the code:-

the only wrong coding I can see it this:-


if ($httpRequest=="CURL"){

$ch = curl_init();
$timeout = 0; // set to zero for no timeout
curl_setopt ($ch, CURLOPT_URL, 'http://ecs.amazonaws.'.CountryId.'/onca/xml?Service=AWSECommerceService&Version='.Version.'&Operation=ItemSearch&ContentType=text%2Fxml&AWSAccessKeyId='.KeyId.'&AssociateTag='.AssociateId.'&SearchIndex='.$searchIndex.'&BrowseNode='.$searchNode.'&Keywords='.urlencode($search).'&ItemPage='.$page.'&Sort='.$sort.'&ResponseGroup=Images,ItemAttributes,OfferFull,Medium,VariationSummary');
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$xml = curl_exec($ch);
curl_close($ch);

$Result = xml_parser($xml);}

else {


Highlighted is the part that is incorrect, the underscore wasn't there. Through the entire code that you posted, xml_parser(); was mentioned twice, make sure that they are with underscore.

T_STRING usually means as there is a missing ; or something like that, I have looked over what I can, and can see nothing else that may be causing the error, hopefully, someone else reading this post could spot something I have missed.

Other than the part I have highlighted, I cannot see anything else.

Hope that this helps in some way.

Cheers,
MRb

starz342

8:46 pm on Mar 23, 2010 (gmt 0)

10+ Year Member



Hello Mathew,

thank you for the reply back once more appreciate it.

Yes I caught that error there as well and did try it but it did not fix it any.

I have been doing research into this further and it seems that amazon did indeed change there coding.

Yes that is the only XML that this script is being opened from.

I found a few other places that posted some sort of new coding but I have no idea as to where to implement it into this php file here that I posted.

Do you think if I posted the URLS here that you might be kind enough to further see if you can guide me as to where I should maybe put the updated coding into this php file that I already posted here?

And yes even though you might think that your help was not alot your end trust me for someone who does not speak php code at all it has helped me out alot.

thank you once again Mathew for all the help you have given thus far I really appreciate it.
And yes as far as the whole coding part went I just thought it would be simpler to just put it all here to better help those who read this to hopefully further assist me with this.

libby

[edited by: starz342 at 8:48 pm (utc) on Mar 23, 2010]

Readie

8:46 pm on Mar 23, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Times I've had the T_STRING error:
  • Missing $ sign on a variable
  • Missing ending quote on a string
  • Missing semi colon (as Matt says above)

In my experience, unexpected $end is usually a missing curly brace ( } )

-----

>> Do you think if I posted the URLS here that you might be kind enough to further see if you can guide me as to where I should maybe put the updated coding into this php file that I already posted here?

Admins may object - make sure they conform with the forum charter, otherwise you'll need to use stickymail

starz342

2:45 am on Mar 24, 2010 (gmt 0)

10+ Year Member



Hi Readie,

thank you very much for that tip there I had been searching for that reason for awhile here with no real answers to it.

see I have Notepad++ here that I am using but not really sure how or what tool to even use to debug, I know Mathew posted a trick there as well but again I have no idea as to where that code goes to check on files? As I again just go line by line here with Notepad++ and compare the code which might I add is a very very long process for me.

How do you then use the sticky-mail feature here please?

I have been trying now since my last post to work with those codes that those other websites have provided and still working on it, I managed to make the errors go away a bit, but that is with using there whole new php file in place of my own php file there above which really is not a good solution as I really wanted to try and keep with my same PHP File here but just alter in there codes that I found at these other websites.


So again hopefully you can advise how I can enter in those URLs then so that yourself or Mathew or any one else that reads this thread can help me to shed and sort this php file out.? Please its driving me mad.
thanks a-lot

libby