//// これは大阪用 ////
//// キーワード無しで入札多いものを引っ張ってくる ////
require_once(dirname(__FILE__) . '/mb_str_replace.function.php');
setlocale(LC_ALL, 'ja_JP.UTF-8');
# mb_のために)以下省略
mb_internal_encoding("UTF-8");
mb_regex_encoding("UTF-8"); // これを入れないと変換に失敗するときがある
$LinkNum=$_GET['link'];
$PicNum=$_GET['pic'];
if ($LinkNum==0)
$LinkNum=0;
else if(strval($LinkNum) != strval(intval($LinkNum)))
$LinkNum=1;
if ($PicNum==0)
$PicNum=1;
if(strval($PicNum) != strval(intval($PicNum)))
$PicNum=1;
/* for debug use only
$a=$_GET['link'];
$b=$_GET['pic'];
$pn=fopen("loglog.log","a+");
fwrite($pn,"LinkNum=$LinkNum\n");
fwrite($pn,"LinkNum=$a\n");
fwrite($pn,"PicNum=$PicNum\n");
fwrite($pn,"PicNum=$b\n");
fclose($pn);
*/
$URL=$_SERVER['HTTP_REFERER']; //print "# $URL #"; exit; //当前页URL
if (empty($URL))
{
header( "Location:http://storeuser6.auctions.yahoo.co.jp/jp/user/ginza_todo" );
/******
header( "Location:http://storeuser7.auctions.yahoo.co.jp/jp/user/h_s_k_stone" );
header( "Location:http://storeuser1.auctions.yahoo.co.jp/jp/user/makototakahashi0316" );
header( "Location:http://storeuser5.auctions.yahoo.co.jp/jp/user/seiancrystal2007" );
header( "Location:http://storeuser4.auctions.yahoo.co.jp/jp/user/crystalyukijp" );
******/
exit;
}
/*
// for debug use only
$pn=fopen("loglog.log","a+");
fwrite($pn,"index.php kicked\n");
fclose($pn);
*/
$KeyWord=file("keyword.txt");
//*********** 当前网页源码 ************
$html=file_get_contents(($URL));
$encode =mb_detect_encoding($html,'ASCII,JIS,EUC-JP,UTF-8,SJIS');
$html=mb_convert_encoding($html, "UTF-8", $encode); //print $mingcheng; //Yahoo的EUC-JP转UTF8编码
$pos1=stripos($html,"
")+7;
$pos2=stripos($html,"");
$mingcheng=substr($html, $pos1, $pos2-$pos1);
//$mingcheng=mb_convert_encoding($mingcheng, "UTF-8", "EUC-JP"); //print $mingcheng; //Yahoo的EUC-JP转UTF8编码
$word="";
for ($i=0; $i
*".$KeyWord[$i]."* --- ";;
$w=explode(" ", $KeyWord[$i]);
$HaveAll = true;
for ( $n=0; $n$i - $n : *".$w[$n]."*";
if ( empty($w[$n]) )
continue;
if ( strpos($mingcheng, $w[$n], 0) === false )
{
$HaveAll = false; //print "NG : *".$w[$n]."*";
break;
}
}
if ($HaveAll == true)
{
$word="銀座東道";
/******
$word="銀座東道".$KeyWord[$i]; //print $KeyWord[$i];
$word="HSK ".$KeyWord[$i]; //print $KeyWord[$i];
$word=$KeyWord[$i]; //print $KeyWord[$i];
******/
break;
}
}
if (empty($word))
$word="銀座東道"; //print "
KeyWord = $word
"; exit;
/******
$word="HSK "; //print "
KeyWord = $word
"; exit;
$word="誠安"; //print "
KeyWord = $word
"; exit;
******/
/* for debug use only
$pn=fopen("loglog.log","a+");
fwrite($pn,"word=$word\n");
fclose($pn);
*/
// 大阪
$seeds[0]="dj0zaiZpPTloN2pOemZGTDlIciZzPWNvbnN1bWVyc2VjcmV0Jng9NGU-";
$seeds[1]="dj0zaiZpPWwwa3VzcDA5RXhZVCZzPWNvbnN1bWVyc2VjcmV0Jng9Yzk-";
$seeds[2]="dj0zaiZpPWNxYTNKcVg1bXdCUiZzPWNvbnN1bWVyc2VjcmV0Jng9M2U-";
$seeds[3]="dj0zaiZpPU14YktLYnJseDMzdSZzPWNvbnN1bWVyc2VjcmV0Jng9MGU-";
$seeds[4]="dj0zaiZpPWdtNlgyYXpiR2RWSCZzPWNvbnN1bWVyc2VjcmV0Jng9ZTQ-";
$seeds[5]="dj0zaiZpPW9rQTFPZm53c09YYyZzPWNvbnN1bWVyc2VjcmV0Jng9YzU-";
$seeds[6]="dj0zaiZpPTFkcGpCNHRrdW1HRyZzPWNvbnN1bWVyc2VjcmV0Jng9NDk-";
$seeds[7]="dj0zaiZpPVZCNFRTbWlQRUROYSZzPWNvbnN1bWVyc2VjcmV0Jng9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HWwhy01d1oFTs0zUOhRGw5rNuVgfRP7uKvLxRw--";
$seeds[3]="91IOLGCxg65pVh9mIU8054BuSpiovGC9eW9xeZwBpcyJhjA.r_2fQe2z1Fr6L5L41aAhFw--";
$seeds[4]="dj0zaiZpPW9wMUdmMkd6WmdEbiZzPWNvbnN1bWVyc2VjcmV0Jng9NWU-";
$seeds[5]="dj0zaiZpPVJwS0dpSFU0SzVyNCZzPWNvbnN1bWVyc2VjcmV0Jng9NzA-";
$seeds[6]="dj0zaiZpPWd0b0kyRFdGNlZuOSZzPWNvbnN1bWVyc2VjcmV0Jng9YzQ-";
$seeds[7]="dj0zaiZpPUFWT0l4eEgwNmg0OCZzPWNvbnN1bWVyc2VjcmV0Jng9N2Y-";
$seeds[8]="dj0zaiZpPURYOW01cTQ3UTRrZCZzPWNvbnN1bWVyc2VjcmV0Jng9MDk-";
$seeds[9]="dj0zaiZpPU12NWhGOEptUmpNdSZzPWNvbnN1bWVyc2VjcmV0Jng9ZDc-";
******/
$seed=rand(0,9);
$appid=$seeds[$seed];
//print $appid." ".$seed; exit;
//*********** 利用 Yahoo API 取得关键字的查询结果 ***********
$url[0]="http://auctions.yahooapis.jp/AuctionWebService/V2/search?appid=". $appid ."&sort=bids&order=a&seller=ginza_todo&query=".urlencode($word);
/******
$url[0]="http://auctions.yahooapis.jp/AuctionWebService/V2/search?appid=". $appid ."&sort=bids&order=a&seller=h_s_k_stone&query=".urlencode($word);
$url[0]="http://auctions.yahooapis.jp/AuctionWebService/V2/search?appid=". $appid ."&sort=bids&order=a&seller=makototakahashi0316&query=".urlencode($word);
$url[0]="http://auctions.yahooapis.jp/AuctionWebService/V2/search?appid=". $appid ."&sort=bids&order=a&seller=seiancrystal2007&query=".urlencode($word);
$url[0]="http://auctions.yahooapis.jp/AuctionWebService/V2/search?appid=". $appid ."&sort=bids&order=a&seller=crystalyukijp&query=".urlencode($word);
******/
$source[0]=file_get_contents($url[0]);
if (stripos($source[0],"") === false)
{
//print "オークション商品ピックアップアイテムを随時更新しております。最新の情報はブラウザの更新を実行してください。";
//exit;
$url[0]="http://auctions.yahooapis.jp/AuctionWebService/V2/search?appid=". $appid ."&sort=bids&order=a&seller=ginza_todo&query=".urlencode("銀座東道");
/******
$url[0]="http://auctions.yahooapis.jp/AuctionWebService/V2/search?appid=". $appid ."&sort=bids&order=a&seller=h_s_k_stone&query=".urlencode("HSK");
$url[0]="http://auctions.yahooapis.jp/AuctionWebService/V2/search?appid=". $appid ."&sort=bids&order=a&seller=makototakahashi0316&query=".urlencode("誠安");
$url[0]="http://auctions.yahooapis.jp/AuctionWebService/V2/search?appid=". $appid ."&sort=bids&order=a&seller=seiancrystal2007&query=".urlencode("誠安");
$url[0]="http://auctions.yahooapis.jp/AuctionWebService/V2/search?appid=". $appid ."&sort=bids&order=a&seller=crystalyukijp&query=".urlencode("誠安");
******/
$source[0]=file_get_contents($url[0]);
}
/* for debug use only
$pn=fopen("loglog.log","a+");
fwrite($pn,"url[0]=$url[0]\n");
fclose($pn);
*/
$row=0;
$tag=array("Title","AuctionItemUrl","Image","CurrentPrice","Bids","EndTime") ;
for ($cnt=0; $cnt") )
{
$pos1=strpos( $content, "- " ) +6;
$pos2=strpos( $content, "
") ;
$line=substr( $content, $pos1 , $pos2 - $pos1 ); //得到每一个产品的段落
$content=substr( $content,$pos2+7, strlen($content) ); //剩余的部分
$li[$row]=$orgin;
for ($i=0; $i"
$tag2="". $tag[$i]; //. ">"
if(strpos($line,$tag1)!==false)
{
$pos1=strpos($line,$tag1) + strlen($tag1);
$line=substr( $line,$pos1, strlen($line) ); //print $line;exit;
$pos1=strpos($line, ">");
$line=substr( $line,$pos1+1, strlen($line) ); //print $line;exit;
$pos1=strpos($line,$tag2) ;
$val=substr($line,0,$pos1); //print $val;
$line=substr( $line,$pos1, strlen($line) ); // print $line;
//根据类别自动设置变量的变量
${$tagname}[$row]=$val; //print $Title[$row]." --- $row ---
";
}
} //for end
if ($AuctionItemUrl[$row] == $URL )//相同图片链接则跳过
continue;
$row++;
// if ($row>7)
if ($row>21)
{
//print "Too Long !!";
break;
}
} //while end
}
$seed=rand(0,9);
$appid=$seeds[$seed];
//print "#$$%%#
"; print count($Title);
if (count($Title)<21) // 当取得的产品过少时(小于5个), 增加产品, 避免网页上出现空白图片链接
{
// $url[1]="http://auctions.yahooapis.jp/AuctionWebService/V2/search?appid=". $appid ."&sort=bids&order=a&seller=ginza_todo&query="."%E9%8A%80%E5%BA%A7%E6%9D%B1%E9%81%93";//銀座東道
$url[1]="http://auctions.yahooapis.jp/AuctionWebService/V2/search?appid=". $appid ."&sort=bids&order=a&page=2&seller=ginza_todo&query=".urlencode("銀座東道");
/******
$url[1]="http://auctions.yahooapis.jp/AuctionWebService/V2/search?appid=". $appid ."&sort=bids&order=a&seller=h_s_k_stone&query=".urlencode("HSK");
$url[1]="http://auctions.yahooapis.jp/AuctionWebService/V2/search?appid=". $appid ."&sort=bids&order=a&seller=makototakahashi0316&query=".urlencode("誠安");
$url[1]="http://auctions.yahooapis.jp/AuctionWebService/V2/search?appid=". $appid ."&sort=bids&order=a&seller=seiancrystal2007&query=".urlencode("誠安");
$url[1]="http://auctions.yahooapis.jp/AuctionWebService/V2/search?appid=". $appid ."&sort=bids&order=a&seller=crystalyukijp&query=".urlencode("誠安");
******/
$source[1]=file_get_contents($url[1]);
/* for debug use only
$pn=fopen("loglog.log","a+");
fwrite($pn,"url[1]=$url[1]\n");
fclose($pn);
*/
$content=&$source[1];
while (strpos( $content, "- ") )
{
$pos1=strpos( $content, "
- " ) +6;
$pos2=strpos( $content, "
") ;
$line=substr( $content, $pos1 , $pos2 - $pos1 ); //得到每一个产品的段落
$content=substr( $content,$pos2+7, strlen($content) ); //剩余的部分
$li[$row]=$orgin;
for ($i=0; $i"
$tag2="". $tag[$i]; //. ">"
if(strpos($line,$tag1)!==false)
{
$pos1=strpos($line,$tag1) + strlen($tag1);
$line=substr( $line,$pos1, strlen($line) ); //print $line;exit;
$pos1=strpos($line, ">");
$line=substr( $line,$pos1+1, strlen($line) ); //print $line;exit;
$pos1=strpos($line,$tag2) ;
$val=substr($line,0,$pos1); //print $val;
$line=substr( $line,$pos1, strlen($line) ); // print $line;
${$tagname}[$row]=$val; //print $Title[$row]." --- $row ---
";;
}
} //for end
if ($AuctionItemUrl[$row] == $URL )//相同图片链接则跳过
continue;
$row++;
// if ($row>5)
if ($row>21)
{
//print "Too Long !!";
break;
}
} //while end
}
if ($LinkNum)
{
//print "";
header( "Location:". $AuctionItemUrl[$LinkNum-1] ); //跳转网页
exit;
}
else if ($PicNum)
{
$jishu=$PicNum-1;
// $CurrentPrice[$jishu]="現在 ".number_format($CurrentPrice[$jishu]) ." 円";
//$EndTime[$jishu]= substr($EndTime[$jishu],8,2) ."日" .substr($EndTime[$jishu],11,5) ."終了";
/*
print "
- ".$CurrentPrice[$jishu]."
- ".$EndTime[$jishu]."
";
*/
// for debug use only
////$CurrentPrice[$jishu] = mb_convert_encoding($CurrentPrice[$jishu], "SJIS", $encode);
$lwork=number_format($CurrentPrice[$jishu]);
//$CurrentPrice[$jishu] = "".$lwork." YEN";
//$lprice="NOW ".$lwork." YEN";
$lprice="現在 ".$lwork." 円";
/*
$encode =mb_detect_encoding($lprice,'ASCII,JIS,EUC-JP,UTF-8,SJIS');
$lprice=mb_convert_encoding($lprice, "SJIS",$encode);
*/
//$encode =mb_detect_encoding("価格",'ASCII,JIS,EUC-JP,UTF-8,SJIS');
//$lprice=mb_convert_encoding("現在", "UTF-8",$encode).$lwork.mb_convert_encoding("円", "UTF-8",$encode);
/* for debug use only
$pn=fopen("loglog.log","a+");
fwrite($pn,"image output\n");
fwrite($pn,"Title[$jishu]=$Title[$jishu]\n");
$encode =mb_detect_encoding($Title[$jishu],'ASCII,JIS,EUC-JP,UTF-8,SJIS');
fwrite($pn,"encode=$encode\n");
fwrite($pn,"CurrentPrice[$jishu]=$CurrentPrice[$jishu]\n");
$encode =mb_detect_encoding($lprice,'ASCII,JIS,EUC-JP,UTF-8,SJIS');
fwrite($pn,"encode=$encode\n");
fwrite($pn,"lprice=$lprice\n");
fclose($pn);
*/
Header("Content-type: image/jpeg");
$im = imagecreateTrueColor(142,200);
$black = ImageColorAllocate($im, 0,0,0);
$white = ImageColorAllocate($im, 255,255,255);
$blue = ImageColorAllocate($im, 0,0,255);
$red = ImageColorAllocate($im, 255,0,0);
imagefilledrectangle($im, 0, 0, imagesX($im), imagesY($im), $white);
$str=$Title[$jishu]; //print $str; //$str=iconv( "Shit-JIS", "UTF-8 ", $str);
$str=mb_str_replace("HSK◆", "", $str);
$str=mb_str_replace("HSK■", "", $str); //print $str;
$str=mb_str_replace("銀座東道◆", "", $str);
$str=mb_str_replace("銀座東道■", "", $str); //print $str;
$str=mb_str_replace("誠安◆", "", $str);
$str=mb_str_replace("誠安■", "", $str); //print $str;
$pos1=mb_strrpos($str,"[",0,"UTF8");//去除出库ID
if ($pos1 === false)
;
else
$str=mb_substr($str, 0, $pos1, "UTF8");
//$font_file = 'msgothic.ttc'; //HGRGM.TTC
$Y=115;
for ( $i=0; $i $sambxy[1]){
// 横画像
imagecopyresampled ( $im , $src, 0 , 0 , 0 , 0 ,imagesX($src) , imagesY($src), imagesX($src) , imagesY($src) );
}else{
// 縦画像
imagecopyresampled ( $im , $src, 35 , 0 , 0 , 0 ,imagesX($src) , imagesY($src), imagesX($src) , imagesY($src) );
}
ImageJPEG($im);
ImageDestroy($im);
}
?>