PHP를 처음 사용했습니다. 아래 코드의 id
이 1123
인 코드를 작성하고 싶습니다. 아무도 나에게 어떤 생각을 줄 수 있니?PHP를 사용하여 html 소스의 클래스 이름을 찾으십시오.
<span class="miniprofile-container /companies/1123?miniprofile="
data-tracking="NUS_CMPY_FOL-nhre"
data-li-getjs="http://s.c.lnkd.licdn.com/scds/concat/common/js?h=dyt8o4nwtaujeutlgncuqe0dn&fc=2">
<strong>
<a href="http://www.linkedin.com/nus-trk?trkact=viewCompanyProfile&pk=biz-overview-public&pp=1&poster=&uid=5674666402166894592&ut=NUS_UNIU_FOLLOW_CMPY&r=&f=0&url=http%3A%2F%2Fwww%2Elinkedin%2Ecom%2Fcompany%2F1123%3Ftrk%3DNUS_CMPY_FOL-nhre&urlhash=7qbc">
Bank of America
</a>
</strong>
</span> has a new Project Manager
참고 : 스팬 클래스의 콘텐츠가 필요하지 않습니다. 스팬 클래스 이름에 id
이 필요합니다.
$dom = new DOMDocument('1.0', 'UTF-8');
@$dom->loadHTML($html);
$xmlElements = simplexml_import_dom($dom);
$id = $xmlElements->xpath("//span [@class='miniprofile-container /companies/$data_id?miniprofile=']");
...하지만 난 더 이상 진행하는 방법을 알고하지 않습니다
나는 다음을 시도했다. 당신의 필요의 의존
당신이 설명해 주시겠습니까 무엇 너 지금까지 해봤 니? – Carsten