Coding Bloom
Mabi_SalesAlarm 진행과정(1) 본문
Main.html
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="jquery-1.12.4.min.js"></script>
<script src="jquery.bxslider.min.js"></script>
<script src="jquery.easing.1.3.js"></script>
<script src="jquery.min.js"></script>
</head>
<body>
<div>hi</div>
<button onclick="memolist()">action</button>
<script>
//
$(document).ready(function(){
const url = 'https://mabinogi.nexon.com/page/common/memo_list_ajax.asp' // 이 부분을 이용하는 서버 URL로 변경
fetch(`https://proxy.cors.sh/${url}`)
.then((response) => response.text())
.then((data) => alert(data));
});
/*function memolist(type,read,open) {
//alert(1)
$.ajax({
url: "/page/common/memo_list_ajax.asp?type="+type+"&read="+ read,
async: false,
type: "post",
dataType: "text",
timeout: 30000,
success: function (data) {
alert(data.substring(data.indexOf("datarow:")+8,));
// 읽지 않은 전체 쪽지
},
error: function (xhr, textStatus, errorThrown) {
//alert("오류가 발생하였습니다.");
}
});
}*/
</script>
</body>
</html>
memolist 메소드가 ajax로 통신을해서 경매장판매 쪽지개수값을 가져오는데,
1.일단 html상에서 ajax를 통해 데이터를 불러오려고하면 CORS정책에 의해 불러올수가 없다.
=> Chrome 속성을 변경하거나, Google Market에서 CORS 라이브러리를 다운받아서 활성화해준다.
=> 현재 코드는 모든 권한을 허용하는(?) 프록시 서버의 주소를 써서 url을 실행한것..
결과 datarow : 0
값은 가져오긴한다.
2. 내가알고싶은건 경매장에 아이템 판매개수 이기때문에 0은 쓸모가없다..
아이템 판매 개수값을 가져오기 위해서 데이터를 조회하기 위한 값을 줘야할것같다. (아이디,User정보 등등)
=> 마비노기 홈페이지에 로그인을 한다. => Session이 생성된다.
mabi%5Fid=6D686730393035
도메인 .mabinogi.nexon.com / Session
login%5Fstate=3
도메인 .mabinogi.nexon.com / Session
이 두개의 세션이 필수데이터값인것같다 이 두개의 세션이 지워지면 값을 불러오지못한다.
이 두개의 세션을 설정하고 값을 불러와보면 어떻게 될까
--
중단한 이유
결국에는 이 값을 핸드폰으로 보고싶은데, 지금 이코드로는 위젯화 할수가없다 JSON형식이었으면
값을 불러와서 쓸수있었을텐데,, ajax로 적용이되어있어서.. 좀더고민이 필요할것같다..
'개발하기' 카테고리의 다른 글
OCR 프로그램만들기 (Tesseract) (0) | 2022.06.21 |
---|---|
광학 문자 인식 (OCR) 프로그램 만들기 (0) | 2022.05.26 |
C# 사용해보기 (0) | 2022.05.24 |
Comments