테스트 사이트 - 개발 중인 베타 버전입니다

사람인 api 오류 관련 문의드립니다. 채택완료

아기강도 6년 전 조회 3,405

안녕하세요.

 

기존에 사람인 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개

toqurk
6년 전

그누보드에서 제공해주는 simplexml_load_string 이 함수가 무언가 틀린것 처럼 보여지는데...

 

simplexml_load_string 말고 Curl 을 사용해서 해보세요..^^

로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

아기강도
6년 전
답변 감사드립니다 ㅠ 말씀해주신 curl에 대한 참고할만한 게시글이나 자료가 있을까요ㅠ?..

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인