파싱할 XML을 지원해 주는 사이트에 가입하여 서비스키 받아오기
<?php $LAWD_CD = '11110' ; //지역코드 $DEAL_YMD = '201606'; //계약월 $Service_Key ='서비스키 입력'; //서비스키 $url ="http://openapi.molit.go.kr:8081/OpenAPI_ToolInstallPackage/service/rest/RTMSOBJSvc/getRTMSDataSvcAptTrade?LAWD_CD=".$LAWD_CD."&DEAL_YMD=".$DEAL_YMD."&serviceKey=".$Service_Key; $data =file_get_contents($url); $xml = simplexml_load_string($data); $obj_addr=$xml->body[0]->items[0];//->item[0]; echo "<table border='1'><tr>"; echo "<td>아파트</td><td>지번</td><td>전용면적</td><td>년</td><td>월</td><td>거래금액</td><td>층</td>"; echo "</tr>"; foreach($obj_addr->item as $value){ echo "<tr>"; echo "<td>".$value->아파트."</td>"; echo "<td>".$value->지번."</td>"; echo "<td>".$value->전용면적."</td>"; echo "<td>".$value->년."</td>"; echo "<td>".$value->월."</td>"; echo "<td>".$value->거래금액."</td>"; echo "<td>".$value->층."</td>"; echo "</tr>"; } echo "</table>"; ?>