I took advantage of the table tags to give a shape to output, example replaces <td class="label">
for Label :
and so on. Only td class="value"
are all messed up, have <td class="value">
and <td class="value" >
etc.
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<?php
$myLine = "";
if(!($myFile=fopen("http://metadados.capes.gov.br/index.php/catalog/100","r"
)))
{
echo "Arquivo não-acessÃvel";
exit;
}
while(!feof($myFile))
{
$myLine .= fgets($myFile,255);
}
fclose($myFile);
$start = '<table class="grid-table survey-info" cellspacing="0">'; //ponto inicial da procura no código fonte da pg
$end = "</table>"; //ponto final da procura no código fonte da pg
$start_position=strpos($myLine, $start);
$end_position=strpos($myLine, $end)+strlen($end);
$length = $end_position - $start_position;
$myLine = substr($myLine, $start_position, $length);
$myLine = str_replace('<table class="grid-table survey-info" cellspacing="0">',"",$myLine);
$myLine = str_replace('</table>',"",$myLine);
$myLine = str_replace('<tr>',"",$myLine);
$myLine = str_replace('</tr>',"<br>",$myLine);
$myLine = str_replace('<tr valign="top" >',"",$myLine);
$myLine = str_replace('<tr itemprop="spatial" itemscope="itemscope" itemtype="http://schema.org/Country">',"",$myLine);
$myLine = str_replace('<tr valign="top" itemprop="producer" itemscope="itemscope" itemtype="http://schema.org/Person">',"",$myLine);
$myLine = str_replace('<td class="value links">',"",$myLine);
$myLine = str_replace('<td class="label">',"Label: ",$myLine);
$myLine = str_replace('<td class="value">',"Valor: ",$myLine);
$myLine = str_replace('<td class="value" itemprop="temporal">',"Valor: ",$myLine);
$myLine = str_replace('<td class="value" itemprop="name">',"Valor: ",$myLine);
$myLine = str_replace('<td class="value" itemprop="name" >',"Valor: ",$myLine);
$myLine = str_replace('<td class="value" >',"Valor: ",$myLine);
$myLine = str_replace('</td>',"",$myLine);
$myLine = preg_replace(array("/\t/", "/\s{2,}/", "/\n/", "/\r/"), array("", " ", " ", " "), $myLine);
echo $myLine;
?>
But get what? only the texts? the HTML inside the table?
– user60252
Only the texts themselves
– Bruno Gama
See if it concerns you: http://kithomepage.com/sos/ttt.php
– user60252
Perfect, like you did to look like this?
– Bruno Gama
I just got it, but if I can send it like you did so I can take a look... VLW for the help
– Bruno Gama
I edited the answer, I had posted the wrong code
– user60252