https://www.tehplayground.com/sh4yJ8CqIwypwkCa가 실제로 그 base64encodes이 이미지 base64ecnoded images 있습니다
여기 (코멘트) 작업 솔루션입니다. 이미지가 base64로 인코딩되었지만이 페이지를 파싱하려면 이미지의 부모 인 태그에 이미지 URL이 실제로 포함되어 있습니다.
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch,CURLOPT_URL,"https://www.zara.com/tr/en/flatform-derby-shoes-with-reversible-fringe-p15318201.html?v1=5276035&v2=734142");
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
$data = curl_exec($ch);
curl_close($ch);
지금은 데이터 조작
libxml_use_internal_errors(true);
$siteData = new DOMDocument();
$siteData->loadHTML($data);
$a = $siteData->getElementsByTagName("a"); //get the a tags
for($i=0;$i<$a->length;$i++){
if($a->item($i)->getAttribute("class")=="_seoImg"){ //_seoImg class is the image class
echo $a->item($i)->getAttribute("href").'<br/>';
}
}
과 결과는
//static.zara.net/photos///2017/I/1/1/p/5318/201/040/3/w/560/5318201040_2_1_1.jpg?ts=1508311623896
//static.zara.net/photos///2017/I/1/1/p/5318/201/040/3/w/560/5318201040_1_1_1.jpg?ts=1508311816920
//static.zara.net/photos///2017/I/1/1/p/5318/201/040/3/w/560/5318201040_2_3_1.jpg?ts=1508311715728
//static.zara.net/photos///2017/I/1/1/p/5318/201/040/3/w/560/5318201040_2_10_1.jpg?ts=1508315639664
//static.zara.net/photos///2017/I/1/1/p/5318/201/040/3/w/560/5318201040_2_2_1.jpg?ts=1508311682567
내 생각 엔 간단한 HTML DOM이 포함되지 않은'src' 년대에 문제가 있다는 것 실제 URL (특별히 버그 추적기를 읽은 후). 이미지 중 하나만 실제로'src'에 URL을 가지고 있습니다. 나머지는'src = "data : image/png; base64, ...."(인라인 이미지)입니다. 대신 PHP의 [DOMDocument] (http://php.net/manual/en/class.domdocument.php)를 사용해 보셨습니까? –
@ MagnusEriksson 당신은 실제 답변으로 제출해야합니다 ... – anarcat
@anarcat 완료. 적절한 코멘트가있는 작업 예제를 포함하기를 원했습니다. –