|
Posted by MS on 02/26/06 18:25
It is part of a contribution i am writing (trying to write) for oscommerce.
Unfortunately I can not give you a page as it is all set up in a protected
area.
The Full function is....(with the set_time_limit removed)
function datafeed_affwin($feed_url){
$rowcount = 1;
// open the csv for reading
//$handle = fopen(HTTP_CATALOG_SERVER . DIR_WS_CATALOG . "feeds/" .
DATAFEED_FILENAME_AW , "r");
$handle = fopen($feed_url , "r");
while (($data = fgetcsv($handle, 2000, ",")) !== FALSE) {
if((DATAFEED_SKIP_AW == 'true') && ($rowcount == 1)){
//Skip first Row
}else{
// make sure all required fields are set.
$continue = true;
$id = array('0','6','7','8','9','10','11','14','15','16','17');
foreach($id as $fieldid){
if(!isset($data[$fieldid])) $continue = false;
}
if($continue === true){
// Work out Price with 2 decimal places
// as some of affwin prices show as GBP13.5
$decpos = strrpos($data[16],'.');
if($decpos === false){
$displayprice = $data[16] . ".00";
}elseif(strlen($data[16])-$decpos == 1){
$displayprice = $data[16] . "00";
}elseif(strlen($data[16])-$decpos == 2){
$displayprice = $data[16] . "0";
}else{
$displayprice = $data[16];
}
$insert_sql_data2 = array('df_affiliate_company' => 'Affiliate Window',
'df_advertiser' => $data[0],
'df_product_name' => $data[6],
'df_manufacturer_name' => $data[7],
'df_promotional_text' => $data[8],
'df_product_description' => $data[9],
'df_deep_link' => $data[10],
'df_image_url' => $data[11],
'df_image_thumb' => '',
'df_expires' => $data[14],
'df_currency' => $data[15],
'df_display_price' => $displayprice,
'df_search_price' => $data[17]);
tep_db_perform(TABLE_DATAFEED, $insert_sql_data2);
}
}
$rowcount++;
}
fclose($handle);
}
// End
As I say.. This function is repeated multiple times....
if(DATAFEED_ACTIVE_AW == 'true') {
$merchant = explode("," , DATAFEED_AW_MERCHANTS);
foreach($merchant as $merchid){
datafeed_affwin('http://products.affiliatewindow.com/csvproductoutput.php?mi
d='. $merchid . '&user=' . DATAFEED_AW_USERID . '&password=' .
DATAFEED_AW_PASSWORD . '&nozip=1'); // Affiliate Window datafeed
}
}
--
----------------------------------------------------------------------------
http://www.myclubweb.co.uk - The Home of Club Websites
----------------------------------------------------------------------------
"DXTrim" <dXtrim@nospam.no> wrote in message
news:44008e5a$0$13890$ba620e4c@news.skynet.be...
> Hi MS,
>
> Please show me a page with the error and post the full code so we are able
> to better help you.
>
> Cheers,
>
> DXTrim
>
>
> "MS" <nospamplaesegr8t_ukuk@yahoo.co.uk> wrote in message
> news:dtnb81$do9$1@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com...
> >
> > > Put the time limit only on top of the script and take it outside the
> loop.
> > > If that does not help, something is causing the time out, but it is
> > dificult
> > > to say without seeing the code and the information is getting
retrieved.
> >
> > I have moved the set_time_limit to the top of the function, also moved
it
> to
> > the top of the calling scripts, I have also put the line in every
calling
> > script and any combination in between, but unfortunately the script is
> > stopping around the usual place.
> >
> > Im at a loss. I thought it maybe a bad record, I was reading but it
> passes
> > this point if I reorder the URLs being read, but the script again falls
> over
> > at around the 12000 records.
> >
> > Any ideas about how to get a miracle?
> >
> > Alex
> >
> >
>
>
Navigation:
[Reply to this message]
|