사람인 api 오류 관련 문의드립니다. 채택완료
안녕하세요.
기존에 사람인 api를 이용해 구인구직 게시판을 만들어 이용해 왔는데
9월1일부터 호출방식이 변경되어 수정중입니다.
호출 url 주소변경 및 key 등록이 추가되어 수정하였는데
아래와 같은 에러가 나서 문의드립니다.
Warning: simplexml_load_string(): Entity: line 1: parser error : Start tag expected, '<' not found in /home/djt_web/djt_admin_center/job_list.php on line 30 Warning: simplexml_load_string(): {"jobs":{"count":15,"start":0,"total":"264","job":[{"url":"http://www.saramin.co in /home/djt_web/djt_admin_center/job_list.php on line 30 Warning: simplexml_load_string(): ^ in /home/djt_web/djt_admin_center/job_list.php on line 30
해당 내용에대한 코드는
</p>
<div style="color: rgb(212, 212, 212); line-height: 19px; font-family: Consolas, "Courier New", monospace; font-size: 14px; font-weight: normal; white-space: pre; background-color: rgb(30, 30, 30);">
<div><span style="color: rgb(197, 134, 192);">if</span><span style="color: rgb(212, 212, 212);">(</span><span style="color: rgb(156, 220, 254);">$stx</span><span style="color: rgb(212, 212, 212);">){</span></div>
<div><span style="color: rgb(212, 212, 212);"> </span><span style="color: rgb(156, 220, 254);">$key</span><span style="color: rgb(212, 212, 212);"> = </span><span style="color: rgb(220, 220, 170);">urlencode</span><span style="color: rgb(212, 212, 212);">(</span><span style="color: rgb(156, 220, 254);">$stx</span><span style="color: rgb(212, 212, 212);">);</span></div>
<div><span style="color: rgb(212, 212, 212);"> </span><span style="color: rgb(197, 134, 192);">if</span><span style="color: rgb(212, 212, 212);">(</span><span style="color: rgb(156, 220, 254);">$page</span><span style="color: rgb(212, 212, 212);">></span><span style="color: rgb(181, 206, 168);">0</span><span style="color: rgb(212, 212, 212);">){</span></div>
<div><span style="color: rgb(212, 212, 212);"> </span><span style="color: rgb(156, 220, 254);">$url</span><span style="color: rgb(212, 212, 212);"> = </span><span style="color: rgb(206, 145, 120);">"<a href="https://oapi.saramin.co.kr/job-search?access-key=******&keywords={" target="_blank" rel="noopener noreferrer">https://oapi.saramin.co.kr/job-search?access-key=******&keywords={</a></span><span style="color: rgb(156, 220, 254);">$key</span><span style="color: rgb(206, 145, 120);">}&sr=directhire&start={</span><span style="color: rgb(156, 220, 254);">$page</span><span style="color: rgb(206, 145, 120);">}&count=15"</span><span style="color: rgb(212, 212, 212);">;</span></div>
<div><span style="color: rgb(212, 212, 212);"> </span><span style="color: rgb(156, 220, 254);">$url_description</span><span style="color: rgb(212, 212, 212);"> = </span><span style="color: rgb(206, 145, 120);">"<a href="https://oapi.saramin.co.kr/job-search/?access-key" target="_blank" rel="noopener noreferrer">https://oapi.saramin.co.kr/job-search/?access-key</a></span><font color="#ce9178">=******&</font><span style="color: rgb(206, 145, 120);">rss=rss&keywords={</span><span style="color: rgb(156, 220, 254);">$key</span><span style="color: rgb(206, 145, 120);">}&sr=directhire&start={</span><span style="color: rgb(156, 220, 254);">$page</span><span style="color: rgb(206, 145, 120);">}&count=15"</span><span style="color: rgb(212, 212, 212);">;</span></div>
<div><span style="color: rgb(212, 212, 212);"> </span><span style="color: rgb(156, 220, 254);">$page</span><span style="color: rgb(212, 212, 212);"> = </span><span style="color: rgb(156, 220, 254);">$page</span><span style="color: rgb(212, 212, 212);">+</span><span style="color: rgb(181, 206, 168);">15</span><span style="color: rgb(212, 212, 212);">;</span></div>
<div><span style="color: rgb(212, 212, 212);"> }</span><span style="color: rgb(197, 134, 192);">else</span><span style="color: rgb(212, 212, 212);">{</span></div>
<div><span style="color: rgb(212, 212, 212);"> </span><span style="color: rgb(156, 220, 254);">$url</span><span style="color: rgb(212, 212, 212);"> = </span><span style="color: rgb(206, 145, 120);">"<a href="https://oapi.saramin.co.kr/job-search?access-key" target="_blank" rel="noopener noreferrer">https://oapi.saramin.co.kr/job-search?access-key</a></span><font color="#ce9178">=******&</font><span style="color: rgb(206, 145, 120);">keywords={</span><span style="color: rgb(156, 220, 254);">$key</span><span style="color: rgb(206, 145, 120);">}&sr=directhire&start=0&count=15"</span><span style="color: rgb(212, 212, 212);">;</span></div>
<div><span style="color: rgb(212, 212, 212);"> </span><span style="color: rgb(156, 220, 254);">$url_description</span><span style="color: rgb(212, 212, 212);"> = </span><span style="color: rgb(206, 145, 120);">"<a href="http://api.saramin.co.kr/job-search/?access-key" target="_blank" rel="noopener noreferrer">http://api.saramin.co.kr/job-search/?access-key</a></span><font color="#ce9178">=******&</font><span style="color: rgb(206, 145, 120);">rss=rss&keywords={</span><span style="color: rgb(156, 220, 254);">$key</span><span style="color: rgb(206, 145, 120);">}&sr=directhire&start=0&count=15"</span><span style="color: rgb(212, 212, 212);">;</span></div>
<div><span style="color: rgb(212, 212, 212);"> </span><span style="color: rgb(156, 220, 254);">$page</span><span style="color: rgb(212, 212, 212);"> = </span><span style="color: rgb(181, 206, 168);">16</span><span style="color: rgb(212, 212, 212);">;</span></div>
<div><span style="color: rgb(212, 212, 212);"> }</span></div>
<div><span style="color: rgb(212, 212, 212);"> </span><span style="color: rgb(156, 220, 254);">$response</span><span style="color: rgb(212, 212, 212);"> = </span><span style="color: rgb(220, 220, 170);">file_get_contents</span><span style="color: rgb(212, 212, 212);">(</span><span style="color: rgb(156, 220, 254);">$url_description</span><span style="color: rgb(212, 212, 212);">);</span></div>
<div><span style="color: rgb(212, 212, 212);"> </span><span style="color: rgb(156, 220, 254);">$object</span><span style="color: rgb(212, 212, 212);"> = </span><span style="color: rgb(220, 220, 170);">simplexml_load_string</span><span style="color: rgb(212, 212, 212);">(</span><span style="color: rgb(156, 220, 254);">$response</span><span style="color: rgb(212, 212, 212);">,</span><span style="color: rgb(206, 145, 120);">'SimpleXMLElement'</span><span style="color: rgb(212, 212, 212);">,LIBXML_NOCDATA);</span></div>
<div><span style="color: rgb(212, 212, 212);"> </span><span style="color: rgb(156, 220, 254);">$description</span><span style="color: rgb(212, 212, 212);"> = </span><span style="color: rgb(156, 220, 254);">$object</span><span style="color: rgb(212, 212, 212);">-></span><span style="color: rgb(156, 220, 254);">channel</span><span style="color: rgb(212, 212, 212);">;</span></div>
<div><span style="color: rgb(212, 212, 212);"> </span><span style="color: rgb(156, 220, 254);">$response</span><span style="color: rgb(212, 212, 212);"> = </span><span style="color: rgb(220, 220, 170);">file_get_contents</span><span style="color: rgb(212, 212, 212);">(</span><span style="color: rgb(156, 220, 254);">$url</span><span style="color: rgb(212, 212, 212);">);</span></div>
<div><span style="color: rgb(212, 212, 212);"> </span><span style="color: rgb(156, 220, 254);">$object</span><span style="color: rgb(212, 212, 212);"> = </span><span style="color: rgb(220, 220, 170);">simplexml_load_string</span><span style="color: rgb(212, 212, 212);">(</span><span style="color: rgb(156, 220, 254);">$response</span><span style="color: rgb(212, 212, 212);">);</span></div>
<div><span style="color: rgb(212, 212, 212);"> </span><span style="color: rgb(156, 220, 254);">$jobs</span><span style="color: rgb(212, 212, 212);"> = </span><span style="color: rgb(156, 220, 254);">$object</span><span style="color: rgb(212, 212, 212);">-></span><span style="color: rgb(156, 220, 254);">jobs</span><span style="color: rgb(212, 212, 212);">;</span></div>
<div><span style="color: rgb(212, 212, 212);"> </span><span style="color: rgb(156, 220, 254);">$temp</span><span style="color: rgb(212, 212, 212);"> = </span><span style="color: rgb(220, 220, 170);">array</span><span style="color: rgb(212, 212, 212);">();</span></div>
<div><span style="color: rgb(212, 212, 212);"> </span><span style="color: rgb(197, 134, 192);">for</span><span style="color: rgb(212, 212, 212);">(</span><span style="color: rgb(156, 220, 254);">$i</span><span style="color: rgb(212, 212, 212);">=</span><span style="color: rgb(181, 206, 168);">0</span><span style="color: rgb(212, 212, 212);">;</span><span style="color: rgb(156, 220, 254);">$i</span><span style="color: rgb(212, 212, 212);"><</span><span style="color: rgb(220, 220, 170);">count</span><span style="color: rgb(212, 212, 212);">(</span><span style="color: rgb(156, 220, 254);">$description</span><span style="color: rgb(212, 212, 212);">-></span><span style="color: rgb(156, 220, 254);">item</span><span style="color: rgb(212, 212, 212);">);</span><span style="color: rgb(156, 220, 254);">$i</span><span style="color: rgb(212, 212, 212);">++){</span></div>
<div><span style="color: rgb(212, 212, 212);"> </span><span style="color: rgb(156, 220, 254);">$cdata</span><span style="color: rgb(212, 212, 212);"> = (</span><span style="color: rgb(86, 156, 214);">string</span><span style="color: rgb(212, 212, 212);">)</span><span style="color: rgb(156, 220, 254);">$description</span><span style="color: rgb(212, 212, 212);">-></span><span style="color: rgb(156, 220, 254);">item</span><span style="color: rgb(212, 212, 212);">[</span><span style="color: rgb(156, 220, 254);">$i</span><span style="color: rgb(212, 212, 212);">]-></span><span style="color: rgb(220, 220, 170);">children</span><span style="color: rgb(212, 212, 212);">(</span><span style="color: rgb(206, 145, 120);">'<a href="http://purl.org/rss/1.0/modules/content/'" target="_blank" rel="noopener noreferrer">http://purl.org/rss/1.0/modules/content/'</a></span><span style="color: rgb(212, 212, 212);">)-></span><span style="color: rgb(156, 220, 254);">encoded</span><span style="color: rgb(212, 212, 212);">;</span></div>
<div><span style="color: rgb(212, 212, 212);"> </span><span style="color: rgb(156, 220, 254);">$jobs</span><span style="color: rgb(212, 212, 212);">-></span><span style="color: rgb(156, 220, 254);">job</span><span style="color: rgb(212, 212, 212);">[</span><span style="color: rgb(156, 220, 254);">$i</span><span style="color: rgb(212, 212, 212);">]-></span><span style="color: rgb(156, 220, 254);">content</span><span style="color: rgb(212, 212, 212);"> = </span><span style="color: rgb(156, 220, 254);">$cdata</span><span style="color: rgb(212, 212, 212);">;</span></div>
<div><span style="color: rgb(212, 212, 212);"> }</span></div>
<div><span style="color: rgb(212, 212, 212);">}</span></div>
</div>
<p>
입니다.
답변 2개
https://www.google.com/search?source=hp&ei=RzWLXYqgJcSImAX_np3YCA&q=php+curl&oq=php+curl&gs_l=psy-ab.3..0l10.988.2392..2671...0.0..0.99.717.8......0....1..gws-wiz.......0i131.P8p_Z3O1iJs&ved=0ahUKEwjK3--t1uvkAhVEBKYKHX9PB4sQ4dUDCAY&uact=5">https://www.google.com/search?source=hp&ei=RzWLXYqgJcSImAX_np3YCA&q=php+curl&oq=php+curl&gs_l=psy-ab.3..0l10.988.2392..2671...0.0..0.99.717.8......0....1..gws-wiz.......0i131.P8p_Z3O1iJs&ved=0ahUKEwjK3--t1uvkAhVEBKYKHX9PB4sQ4dUDCAY&uact=5
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인