osx - Use PHP on Mac OS X to Create DOS-format Text File for Bing Product Feed -
i want use php script process google product feed create bing product feed, should tab delimited text file... far, can bing recognize "2" columns in file when tested. suspect due requiring utf-8 encoded "dos formatted" text file. far have this:
open file feed:
$bing = fopen('bing_products.txt','ab');
create header row:
$header_row="mpid title brandormanufacturer merchantsku producturl price stockstatus description imageurl bingcategory condition\r\n";
loop through products:
$bing_text.=bing_simpl($item_number)." "; $bing_text.=bing_simpl($name." color ".substr($item_number, 3,4)." size ".$unit_of_measure)." "; $bing_text.=bing_simpl($manufacturer)." "; $bing_text.=bing_simpl($item_number)." "; $bing_text.="https://example.com/".$general_category."/".strtolower($item_no_three)." "; $bing_text.=number_format($price_one,2)." "; $bing_text.="in stock "; $bing_text.=bing_simpl($descript." color ".substr($item_number, 3,4)." size ".$unit_of_measure)." "; $bing_text.=$image_url." "; $bing_text.=$general_category.">".simpl($craft).">".simpl($key_word_i)." "; $bing_text.= "new\r\n";
write , close file:
fwrite($bing, $header_row.$bing_text);fclose($bing);
optionally add utf-8 bytecode:
$str=file_get_contents('bing_products.txt'); file_put_contents('bing_products.txt',"\xef\xbb\xbf".$str);
"bing_simpl" , "canonical_name" strip extraneous formatting. i've tried using "\t" tabs. i've tried without file_get_contents / file_put_contents... testing file encoding php returns ascii (it should indeed utf-8, i'm processing exported xml file form filemaker).
am missing simple?
[update] appears part of issue using either gzip, or finder's "compress" functions compress feed file. i.e. can truncated, uncompressed version of file work ok (has small enough work bing's "test" form). update if i'm able find work-around use compressed versions.
bing products support google shopping seamlessly. http://www.cpcstrategy.com/blog/2014/04/google-feed-for-bing-shopping-product-ads/
if have access windows machine, create bingproducts.txt file using notepad , examine headers , tab newline characters in vim?
Comments
Post a Comment