이것 좀 봐 주세여 정보
이것 좀 봐 주세여본문
http://sir.co.kr/bbs/board.php?bo_table=g4_skin&wr_id=111069
위에 유창화님의 스킨을 사용중입니다.
위 스킨에 제 링크프라이스 옥션코드(http://click.linkprice.com/click.php?m=auction&a=A100273055&l=0000&u_id=)를 넣어 상품 클릭시 제코드를 통해 연결 되도록 하려고 합니다.
전에 같은 질문을 한 번 올렸으나 답변이 없고 이미 위 스킨에 링크프라이스 코드를 넣어 적용 하신 분이 계셔서 염치불구 하고 쪽지를 남겼으나 역시 답이 없으셔서 혼자 이리저리 수정 해 봐도 안 돼 링크프라이스에 문의까지 했으나 그 쪽에선 그누보드를 다뤄본적이 없어 확실한 답을 못 주더군여
해서 이렇게 다시 문의드립니다.
아래는 위 스킨의 list.skin.php 소스입니다.
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
// 선택옵션으로 인해 셀합치기가 가변적으로 변함
$colspan = 5;
//if ($is_category) $colspan++;
if ($is_checkbox) $colspan++;
if ($is_good) $colspan++;
if ($is_nogood) $colspan++;
// 제목이 두줄로 표시되는 경우 이 코드를 사용해 보세요.
// <nobr style='display:block; overflow:hidden; width:000px;'>제목</nobr>
?>
<style>
.board_top { clear:both; }
.board_list { clear:both; width:100%; table-layout:fixed; margin:5px 0 0 0; }
.board_list th { font-weight:bold; font-size:12px; }
.board_list th { background:url(<?=$board_skin_path?>/img/title_bg.gif) repeat-x; }
.board_list th { white-space:nowrap; height:34px; overflow:hidden; text-align:center; }
.board_list th { border-top:1px solid #ddd; border-bottom:1px solid #ddd; }
.board_list tr.bg0 { background-color:#fafafa; }
.board_list tr.bg1 { background-color:#ffffff; }
.board_list td { padding:.5em; }
.board_list td { border-bottom:1px solid #ddd; }
.board_list td.num { color:#999999; text-align:center; }
.board_list td.checkbox { text-align:center; }
.board_list td.subject { overflow:hidden; }
.board_list td.name { padding:0 0 0 10px; }
.board_list td.datetime { font:normal 11px tahoma; color:#BABABA; text-align:center; }
.board_list td.hit { font:normal 11px tahoma; color:#BABABA; text-align:center; }
.board_list td.good { font:normal 11px tahoma; color:#BABABA; text-align:center; }
.board_list td.nogood { font:normal 11px tahoma; color:#BABABA; text-align:center; }
.board_list .notice { font-weight:normal; }
.board_list .current { font:bold 11px tahoma; color:#E15916; }
.board_list .comment { font-family:Tahoma; font-size:10px; color:#EE5A00; }
.board_button { clear:both; margin:10px 0 0 0; }
.board_page { clear:both; text-align:center; margin:3px 0 0 0; }
.board_page a:link { color:#777; }
.board_search { text-align:center; margin:10px 0 0 0; }
.board_search .stx { height:21px; border:1px solid #9A9A9A; border-right:1px solid #D8D8D8; border-bottom:1px solid #D8D8D8; }
</style>
<?php
//http://kr.php.net/manual/en/function.fsockopen.php 첫번째 코멘트에 있는것입니다.
function http_request(
$verb = 'GET', /* HTTP Request Method (GET and POST supported) */
$ip, /* Target IP/Hostname */
$port = 80, /* Target TCP port */
$uri = '/', /* Target URI */
$getdata = array(), /* HTTP GET Data ie. array('var1' => 'val1', 'var2' => 'val2') */
$postdata = array(), /* HTTP POST Data ie. array('var1' => 'val1', 'var2' => 'val2') */
$cookie = array(), /* HTTP Cookie Data ie. array('var1' => 'val1', 'var2' => 'val2') */
$custom_headers = array(), /* Custom HTTP headers ie. array('Referer: http://localhost/ */
$timeout = 1000, /* Socket timeout in milliseconds */
$req_hdr = false, /* Include HTTP request headers */
$res_hdr = false /* Include HTTP response headers */
)
{
$ret = '';
$verb = strtoupper($verb);
$cookie_str = '';
$getdata_str = count($getdata) ? '?' : '';
$postdata_str = '';
foreach ($getdata as $k => $v)
$getdata_str .= urlencode($k) .'='. urlencode($v) . '&';
foreach ($postdata as $k => $v)
$postdata_str .= urlencode($k) .'='. urlencode($v) .'&';
foreach ($cookie as $k => $v)
$cookie_str .= urlencode($k) .'='. urlencode($v) .'; ';
$crlf = "\r\n";
$req = $verb .' '. $uri . $getdata_str .' HTTP/1.1' . $crlf;
$req .= 'Host: '. $ip . $crlf;
$req .= 'User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:6.0.2) Gecko/20100101 Firefox/6.0.2' . $crlf;
$req .= 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' . $crlf;
$req .= 'Accept-Language: ko-kr,ko;q=0.8,en-us;q=0.5,en;q=0.3' . $crlf;
$req .= 'Accept-Encoding: gzip, deflate' . $crlf;
$req .= 'Accept-Charset: EUC-KR,utf-8;q=0.7,*;q=0.7' . $crlf;
foreach ($custom_headers as $k => $v)
$req .= $k .': '. $v . $crlf;
if (!empty($cookie_str))
$req .= 'Cookie: '. substr($cookie_str, 0, -2) . $crlf;
if ($verb == 'POST' && !empty($postdata_str))
{
$postdata_str = substr($postdata_str, 0, -1);
$req .= 'Content-Type: application/x-www-form-urlencoded' . $crlf;
$req .= 'Content-Length: '. strlen($postdata_str) . $crlf . $crlf;
$req .= $postdata_str;
}
else $req .= $crlf;
if ($req_hdr)
$ret .= $req;
if (($fp = @fsockopen($ip, $port, $errno, $errstr)) == false)
return "Error $errno: $errstr\n";
stream_set_timeout($fp, 0, $timeout * 1000);
fputs($fp, $req);
while ($line = fgets($fp)) $ret .= $line;
fclose($fp);
if (!$res_hdr)
$ret = substr($ret, strpos($ret, "\r\n\r\n") + 4);
return $ret;
}
//옥션 베스트 페이지 읽어옴
$text = gzinflate(http_request('GET', 'corners.auction.co.kr', 80, '/corner/categorybest.aspx?catetab=2'));
preg_match_all("`<div class=\"img\"><a href=\"([^\"]+)\".+><img.+src=\"([^\"]+)\" style=\"height:130px;width:130px;\" /></a></div>.+<em><a[^>]+>(.+)</a></em>.+<ul class=\"sell\">(.+)</ul>`Us", $text, $m);
$data = Array();
if (is_array($m[1])) {
foreach($m[1] as $k => $v){
$data[$k]['title'] = iconv('euc-kr', 'utf-8', $m[3][$k]);
$data[$k]['link'] = $m[1][$k];
$data[$k]['img'] = $m[2][$k];
preg_match_all("`<span class=\"(cost|sale)\">(.+)</span>`U", $m[4][$k], $m2);
if (is_array($m2)){
foreach($m2[1] as $k2 => $v2){
$data[$k][$v2] = strip_tags(iconv('euc-kr', 'utf-8', $m2[2][$k2]));
}
}
}
//랜덤 사용안할때는 shuffle 주석 다세요
//shuffle($data);
$data = array_slice($data, 0, 100);
}
?>
<!-- 옥션 베스트 목록 시작 -->
<table width="<?=$width?>" align="center" cellpadding="0" cellspacing="0" bgcolor="#F6F6F6"><tr><td>
<?
foreach($data as $k => $v){
echo "
<div style='float:left; width:20%; height:250px; text-align:center;'>
<div style='padding-bottom:5;'><font color=#8C8C8C size=4><b>" . ($k + 1) . "</font></b></div>
<div><a href='". $v['link'] . "' target='_blank'><img src='" . $v['img'] . "'></a></div>
<center><div style='width:130px; height:50px; overflow:hidden; padding-top:5;'><a href='" . $v['link'] . "' target='_blank'>" . $v['title'] . "</a></div></center>
";
if (!empty($v['cost']) && !empty($v['sale'])) {
echo "<div style='padding-top:5;'><strike><font color=#8C8C8C>판매가 : " . $v['cost'] . "</font></strike></div><div style='padding-bottom:20;'><font color=#FF0000><b>할인가</font> : " . $v['sale'] . "</b></div>";
}
else if (!empty($v['cost'])){
echo "<div>판매가 : " . $v['cost'] . "</div>";
}
else if (!empty($v['sale'])){
echo "<div style='padding-top:20;'><font color=#FF0000><b>할인가</font> : " . $v['sale'] . "</b></div>";
}
echo "</div>
";
}
?>
</td></tr></table>
해당 소스에서 . $v['link'] . 이 부분을 수정하면 될 것 같은데 아무리 해 봐도 안 되네여
고수님들께서 좀 보시고 답변 부탁드립니다(__)
위에 유창화님의 스킨을 사용중입니다.
위 스킨에 제 링크프라이스 옥션코드(http://click.linkprice.com/click.php?m=auction&a=A100273055&l=0000&u_id=)를 넣어 상품 클릭시 제코드를 통해 연결 되도록 하려고 합니다.
전에 같은 질문을 한 번 올렸으나 답변이 없고 이미 위 스킨에 링크프라이스 코드를 넣어 적용 하신 분이 계셔서 염치불구 하고 쪽지를 남겼으나 역시 답이 없으셔서 혼자 이리저리 수정 해 봐도 안 돼 링크프라이스에 문의까지 했으나 그 쪽에선 그누보드를 다뤄본적이 없어 확실한 답을 못 주더군여
해서 이렇게 다시 문의드립니다.
아래는 위 스킨의 list.skin.php 소스입니다.
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
// 선택옵션으로 인해 셀합치기가 가변적으로 변함
$colspan = 5;
//if ($is_category) $colspan++;
if ($is_checkbox) $colspan++;
if ($is_good) $colspan++;
if ($is_nogood) $colspan++;
// 제목이 두줄로 표시되는 경우 이 코드를 사용해 보세요.
// <nobr style='display:block; overflow:hidden; width:000px;'>제목</nobr>
?>
<style>
.board_top { clear:both; }
.board_list { clear:both; width:100%; table-layout:fixed; margin:5px 0 0 0; }
.board_list th { font-weight:bold; font-size:12px; }
.board_list th { background:url(<?=$board_skin_path?>/img/title_bg.gif) repeat-x; }
.board_list th { white-space:nowrap; height:34px; overflow:hidden; text-align:center; }
.board_list th { border-top:1px solid #ddd; border-bottom:1px solid #ddd; }
.board_list tr.bg0 { background-color:#fafafa; }
.board_list tr.bg1 { background-color:#ffffff; }
.board_list td { padding:.5em; }
.board_list td { border-bottom:1px solid #ddd; }
.board_list td.num { color:#999999; text-align:center; }
.board_list td.checkbox { text-align:center; }
.board_list td.subject { overflow:hidden; }
.board_list td.name { padding:0 0 0 10px; }
.board_list td.datetime { font:normal 11px tahoma; color:#BABABA; text-align:center; }
.board_list td.hit { font:normal 11px tahoma; color:#BABABA; text-align:center; }
.board_list td.good { font:normal 11px tahoma; color:#BABABA; text-align:center; }
.board_list td.nogood { font:normal 11px tahoma; color:#BABABA; text-align:center; }
.board_list .notice { font-weight:normal; }
.board_list .current { font:bold 11px tahoma; color:#E15916; }
.board_list .comment { font-family:Tahoma; font-size:10px; color:#EE5A00; }
.board_button { clear:both; margin:10px 0 0 0; }
.board_page { clear:both; text-align:center; margin:3px 0 0 0; }
.board_page a:link { color:#777; }
.board_search { text-align:center; margin:10px 0 0 0; }
.board_search .stx { height:21px; border:1px solid #9A9A9A; border-right:1px solid #D8D8D8; border-bottom:1px solid #D8D8D8; }
</style>
<?php
//http://kr.php.net/manual/en/function.fsockopen.php 첫번째 코멘트에 있는것입니다.
function http_request(
$verb = 'GET', /* HTTP Request Method (GET and POST supported) */
$ip, /* Target IP/Hostname */
$port = 80, /* Target TCP port */
$uri = '/', /* Target URI */
$getdata = array(), /* HTTP GET Data ie. array('var1' => 'val1', 'var2' => 'val2') */
$postdata = array(), /* HTTP POST Data ie. array('var1' => 'val1', 'var2' => 'val2') */
$cookie = array(), /* HTTP Cookie Data ie. array('var1' => 'val1', 'var2' => 'val2') */
$custom_headers = array(), /* Custom HTTP headers ie. array('Referer: http://localhost/ */
$timeout = 1000, /* Socket timeout in milliseconds */
$req_hdr = false, /* Include HTTP request headers */
$res_hdr = false /* Include HTTP response headers */
)
{
$ret = '';
$verb = strtoupper($verb);
$cookie_str = '';
$getdata_str = count($getdata) ? '?' : '';
$postdata_str = '';
foreach ($getdata as $k => $v)
$getdata_str .= urlencode($k) .'='. urlencode($v) . '&';
foreach ($postdata as $k => $v)
$postdata_str .= urlencode($k) .'='. urlencode($v) .'&';
foreach ($cookie as $k => $v)
$cookie_str .= urlencode($k) .'='. urlencode($v) .'; ';
$crlf = "\r\n";
$req = $verb .' '. $uri . $getdata_str .' HTTP/1.1' . $crlf;
$req .= 'Host: '. $ip . $crlf;
$req .= 'User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:6.0.2) Gecko/20100101 Firefox/6.0.2' . $crlf;
$req .= 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' . $crlf;
$req .= 'Accept-Language: ko-kr,ko;q=0.8,en-us;q=0.5,en;q=0.3' . $crlf;
$req .= 'Accept-Encoding: gzip, deflate' . $crlf;
$req .= 'Accept-Charset: EUC-KR,utf-8;q=0.7,*;q=0.7' . $crlf;
foreach ($custom_headers as $k => $v)
$req .= $k .': '. $v . $crlf;
if (!empty($cookie_str))
$req .= 'Cookie: '. substr($cookie_str, 0, -2) . $crlf;
if ($verb == 'POST' && !empty($postdata_str))
{
$postdata_str = substr($postdata_str, 0, -1);
$req .= 'Content-Type: application/x-www-form-urlencoded' . $crlf;
$req .= 'Content-Length: '. strlen($postdata_str) . $crlf . $crlf;
$req .= $postdata_str;
}
else $req .= $crlf;
if ($req_hdr)
$ret .= $req;
if (($fp = @fsockopen($ip, $port, $errno, $errstr)) == false)
return "Error $errno: $errstr\n";
stream_set_timeout($fp, 0, $timeout * 1000);
fputs($fp, $req);
while ($line = fgets($fp)) $ret .= $line;
fclose($fp);
if (!$res_hdr)
$ret = substr($ret, strpos($ret, "\r\n\r\n") + 4);
return $ret;
}
//옥션 베스트 페이지 읽어옴
$text = gzinflate(http_request('GET', 'corners.auction.co.kr', 80, '/corner/categorybest.aspx?catetab=2'));
preg_match_all("`<div class=\"img\"><a href=\"([^\"]+)\".+><img.+src=\"([^\"]+)\" style=\"height:130px;width:130px;\" /></a></div>.+<em><a[^>]+>(.+)</a></em>.+<ul class=\"sell\">(.+)</ul>`Us", $text, $m);
$data = Array();
if (is_array($m[1])) {
foreach($m[1] as $k => $v){
$data[$k]['title'] = iconv('euc-kr', 'utf-8', $m[3][$k]);
$data[$k]['link'] = $m[1][$k];
$data[$k]['img'] = $m[2][$k];
preg_match_all("`<span class=\"(cost|sale)\">(.+)</span>`U", $m[4][$k], $m2);
if (is_array($m2)){
foreach($m2[1] as $k2 => $v2){
$data[$k][$v2] = strip_tags(iconv('euc-kr', 'utf-8', $m2[2][$k2]));
}
}
}
//랜덤 사용안할때는 shuffle 주석 다세요
//shuffle($data);
$data = array_slice($data, 0, 100);
}
?>
<!-- 옥션 베스트 목록 시작 -->
<table width="<?=$width?>" align="center" cellpadding="0" cellspacing="0" bgcolor="#F6F6F6"><tr><td>
<?
foreach($data as $k => $v){
echo "
<div style='float:left; width:20%; height:250px; text-align:center;'>
<div style='padding-bottom:5;'><font color=#8C8C8C size=4><b>" . ($k + 1) . "</font></b></div>
<div><a href='". $v['link'] . "' target='_blank'><img src='" . $v['img'] . "'></a></div>
<center><div style='width:130px; height:50px; overflow:hidden; padding-top:5;'><a href='" . $v['link'] . "' target='_blank'>" . $v['title'] . "</a></div></center>
";
if (!empty($v['cost']) && !empty($v['sale'])) {
echo "<div style='padding-top:5;'><strike><font color=#8C8C8C>판매가 : " . $v['cost'] . "</font></strike></div><div style='padding-bottom:20;'><font color=#FF0000><b>할인가</font> : " . $v['sale'] . "</b></div>";
}
else if (!empty($v['cost'])){
echo "<div>판매가 : " . $v['cost'] . "</div>";
}
else if (!empty($v['sale'])){
echo "<div style='padding-top:20;'><font color=#FF0000><b>할인가</font> : " . $v['sale'] . "</b></div>";
}
echo "</div>
";
}
?>
</td></tr></table>
해당 소스에서 . $v['link'] . 이 부분을 수정하면 될 것 같은데 아무리 해 봐도 안 되네여
고수님들께서 좀 보시고 답변 부탁드립니다(__)
댓글 전체
print_r2($data);
로 배열을 어떻게 가져오는지를 확인하시고 값을 불러오시면 될득
로 배열을 어떻게 가져오는지를 확인하시고 값을 불러오시면 될득
제가 이쪽으론 무지한지라 좀 더 자세한 설명 부탁드릴게여
<!-- 옥션 베스트 목록 시작 -->
<table width="<?=$width?>" align="center" cellpadding="0" cellspacing="0" bgcolor="#F6F6F6"><tr><td>
<?
print_r2($data); <===== 요기에 이렇게
foreach($data as $k => $v){
이런식으로 하셔서 $data의 값들이 어떻게 들어가있는지를 확인하셔서 고치셔야합니다
array(
~~~~~~~~
~~~~~~~
);
이런식으로 나올겁니다. 거기서 원하는 링크하구 값하고 찾으셔야해요
잘모르시면 스샷찍어서 올리고 조언구하셔요
<table width="<?=$width?>" align="center" cellpadding="0" cellspacing="0" bgcolor="#F6F6F6"><tr><td>
<?
print_r2($data); <===== 요기에 이렇게
foreach($data as $k => $v){
이런식으로 하셔서 $data의 값들이 어떻게 들어가있는지를 확인하셔서 고치셔야합니다
array(
~~~~~~~~
~~~~~~~
);
이런식으로 나올겁니다. 거기서 원하는 링크하구 값하고 찾으셔야해요
잘모르시면 스샷찍어서 올리고 조언구하셔요
말씀 하신대로 해 보니
Array
(
[0] => Array
(
[title] => [기획특가] 대박가격 남자 기모맨투맨 무료배송 3900원 다운점퍼/후드점퍼/체크남방/패딩점퍼/패딩잠바
[link] => http://through.auction.co.kr/common/SafeRedirect.aspx?auction=-1&sort=14&page=0&product=2&area=0&cc=AA12&Fwc=&Fwk=&next=http://itempage3.auction.co.kr/detailview.aspx?ItemNo=A697918330&listqs=catetab%253d1%2526class%253dCorner.CategoryBest%2526listorder%253d0&listtitle=����Ʈ100&frm2=through
[img] => http://image2.auction.co.kr/itemimage/52/56/e4/5256e4812.jpg
[cost] => 10,900원
[sale] => 8,900원
)
[1] => Array
(
[title] => [히로키샵]봄신상컬러스키니/6900원무료배송/스판스키니/스판밴드/블랙진/레깅스/구제/청바지/빅사이즈/기모스키니/
[link] => http://through.auction.co.kr/common/SafeRedirect.aspx?auction=-1&sort=14&page=0&product=2&area=0&cc=AA12&Fwc=&Fwk=&next=http://itempage3.auction.co.kr/detailview.aspx?ItemNo=A531893783&listqs=catetab%253d1%2526class%253dCorner.CategoryBest%2526listorder%253d1&listtitle=����Ʈ100&frm2=through
[img] => http://image3.auction.co.kr/itemimage/52/ac/3f/52ac3fc32.jpg
[cost] => 19,900원
[sale] => 6,900원
)
이렇게 나오네여
제가 너무 번거롭게 해 드리는 것 같아 죄송합니다.
Array
(
[0] => Array
(
[title] => [기획특가] 대박가격 남자 기모맨투맨 무료배송 3900원 다운점퍼/후드점퍼/체크남방/패딩점퍼/패딩잠바
[link] => http://through.auction.co.kr/common/SafeRedirect.aspx?auction=-1&sort=14&page=0&product=2&area=0&cc=AA12&Fwc=&Fwk=&next=http://itempage3.auction.co.kr/detailview.aspx?ItemNo=A697918330&listqs=catetab%253d1%2526class%253dCorner.CategoryBest%2526listorder%253d0&listtitle=����Ʈ100&frm2=through
[img] => http://image2.auction.co.kr/itemimage/52/56/e4/5256e4812.jpg
[cost] => 10,900원
[sale] => 8,900원
)
[1] => Array
(
[title] => [히로키샵]봄신상컬러스키니/6900원무료배송/스판스키니/스판밴드/블랙진/레깅스/구제/청바지/빅사이즈/기모스키니/
[link] => http://through.auction.co.kr/common/SafeRedirect.aspx?auction=-1&sort=14&page=0&product=2&area=0&cc=AA12&Fwc=&Fwk=&next=http://itempage3.auction.co.kr/detailview.aspx?ItemNo=A531893783&listqs=catetab%253d1%2526class%253dCorner.CategoryBest%2526listorder%253d1&listtitle=����Ʈ100&frm2=through
[img] => http://image3.auction.co.kr/itemimage/52/ac/3f/52ac3fc32.jpg
[cost] => 19,900원
[sale] => 6,900원
)
이렇게 나오네여
제가 너무 번거롭게 해 드리는 것 같아 죄송합니다.
$data[$k]['link'] = $m[1][$k];
이부분을
$data[$k]['link'] = '링크프라이스주소&tu=' . urlencode(preg_replace("`^.+&next=`", '', $m[1][$k]));
이런식으로 하면 될거 같네요.
링크프라이스주소는 링크프라이스 > 셀프서비스 > 사용자정의링크에서 생성된 주소에서 &tu= 의 앞부분 까지 입니다.
이부분을
$data[$k]['link'] = '링크프라이스주소&tu=' . urlencode(preg_replace("`^.+&next=`", '', $m[1][$k]));
이런식으로 하면 될거 같네요.
링크프라이스주소는 링크프라이스 > 셀프서비스 > 사용자정의링크에서 생성된 주소에서 &tu= 의 앞부분 까지 입니다.
너무 감사드립니다.
이렇게 친절히 놓칠 수 있는 부분까지 설명해 주셔서 원하는대로 해결 됐습니다.
주말 잘 보내시고 다시 한 번 머리숙여 감사드립니다(__)
이렇게 친절히 놓칠 수 있는 부분까지 설명해 주셔서 원하는대로 해결 됐습니다.
주말 잘 보내시고 다시 한 번 머리숙여 감사드립니다(__)