English 中文(简体)
从边远地点获取内容的工作不多,但原因何在?
原标题:Loading content from remote site doesn t work, but why?

Im仍在为客户编制这一目录,通过PHP和简单的DOM Parser将图像从一个偏远地区上载。

// Code excerpt from http://internetvolk.de/fileadmin/template/res/scrape.php, this is just one case of a select

$subcat = $_GET[ subcat ];
$url = "http://pinesite.com/meubelen/index.php?".$subcat."&lang=de";
$html = file_get_html(html_entity_decode($url));
$iframe = $html->find( iframe ,0);
$url2 = $iframe->src;
$html->clear(); 
unset($html);
$fullurl = "http://pinesite.com/meubelen/".$url2;
$html2 = file_get_html(html_entity_decode($fullurl));
$pagecount = 1;
$titles = $html2->find( .tekst );
$images = $html2->find( .plaatje );
$output=  ;
$i=0;
foreach ($images as $image) {
$item[ title ] = $titles[$i]->find( p ,0)->plaintext;
$imagePath = $image->find( img ,0)->src;
$item[ thumb ] = resize("http://pinesite.com".str_replace( thumb_ ,  ,$imagePath),array("w"=>225, "h"=>162));
$item[ image ] =  http://pinesite.com .str_replace( thumb_ ,  ,$imagePath);
$fullurl2 = "http://pinesite.com/meubelen/prog/showpic.php?src=".str_replace( thumb_ ,  ,$imagePath)."&taal=de";
$html3 = file_get_html($fullurl2);
$item[ size ] = str_replace(    ,  ,$html3->find( td ,1)->plaintext);
unset($html3);
$output[] = $item;
$i++;
}
if (count($html2->find( center )) > 1) {
// ok, multi-page here, let s find out how many there are
$pagecount = count($html2->find( center ,0)->find( a ))-1;
for ($i=1;$i<$pagecount; $i++) {
$startID = $i*20;
$newurl = html_entity_decode($fullurl."&beginrec=".$startID);
$html3 = file_get_html($newurl);
$titles = $html3->find( .tekst );
$images = $html3->find( .plaatje );
$a=0;
foreach ($images as $image) {
$item[ title ] = $titles[$a]->find( p ,0)->plaintext;
$item[ image ] =  http://pinesite.com .str_replace( thumb_ ,  ,$image->find( img ,0)->src);
$item[ thumb ] = resize($item[ image ],array("w"=>225, "h"=>150));
$output[] = $item;
$a++;
}
$html3->clear();
unset ($html3);
}
}
echo json_encode($output);

因此,它应当做些什么(并且涉及某些类别): http://pinesite.com。

例如,如果你通过“功能=images&subcat=antiek”,但不通过“功能=images&subcat=stoelen”。 我甚至不认为这是一个与遥远的网页有关的问题,因此,我的法典必须出现错误。

问题回答

Ehm.trying to state the clear maybe but stoele ?

我的法典被完全罚款,是偏远地区的超文本空洞的空地,因此,PHP DOM Parser不承认I正在寻找的机体。 我最后确定,先在法典上操作一个小体,取代错误代码。

我知道这是一个ir脏的解决方案,但努力:





相关问题
Parse players currently in lobby

I m attempting to write a bash script to parse out the following log file and give me a list of CURRENT players in the room (so ignoring players that left, but including players that may have rejoined)...

How to get instance from string in C#?

Is it possible to get the property of a class from string and then set a value? Example: string s = "label1.text"; string value = "new value"; label1.text = value; <--and some code that makes ...

XML DOM parsing br tag

I need to parse a xml string to obtain the xml DOM, the problem I m facing is with the self closing html tag like <br /> giving me the error of Tag mismatch expected </br>. I m aware this ...

Ruby parser in Java

The project I m doing is written in Java and parsers source code files. (Java src up to now). Now I d like to enable parsing Ruby code as well. Therefore I am looking for a parser in Java that parses ...

Locating specific string and capturing data following it

I built a site a long time ago and now I want to place the data into a database without copying and pasting the 400+ pages that it has grown to so that I can make the site database driven. My site ...

热门标签