Unable to save the last xml file php -
i new php, , have written code work amazon api. when request information api, receive it, unable sort through xml. here error:
fatal error: call member function children() on null in j:\xampp\htdocs\phillip\src\marketplacewebserviceproducts\samples\csv_prep.php on line 117
here code:
if(is_array($xmlfiles)){ foreach($xmlfiles $xmlfile){ $xml = simplexml_load_file($xmlfile); foreach($xml->getmatchingproductforidresult $items) { //line 117 -> if(isset($items->products->product->attributesets->children('ns2', true)->itemattributes->listprice->amount) !== false) { $amount = $items->products->product->attributesets->children('ns2', true)->itemattributes->listprice->amount }else{ $amount = '0.00'; } } } }
the tag in xml trying value of looks this:
<ns2:amount>9.99</ns2:amount>
it in same place says in code. have problem large files , not sure happening. if help, appreciate it. in advance!
i'm not certain, based on error message, looks somewhere in $items->products->product->attributesets
hierarchy you're specifying not exist.
do tests see if $items
or $items->products
or $items->products->product
or $items->products->product->attributesets
, whichever 1 fails, print out fact , call exit;
.
you print_r
on $items
well.
Comments
Post a Comment