Reputation: 97
I'm using phpQuery to fetch string from given url. as you can see in the image, there is a three space at the end of string appears like
in chrome developer tools. i've used trim, str_replace(" ","...")
and tried to convert unicode then remove it. but no luck.
foreach(pq("div.index-title") as $sol_frame_basliklar){
$baslik_text = pq($sol_frame_basliklar)->contents()->eq(0)->html();
$baslik_entry_sayisi = pq($sol_frame_basliklar)->contents()->eq(1)->text();
$baslik_text = trim($baslik_text, "\xC2\xA0\n" );
echo '<tr >
<td valign="top">· </td>
<td width="192" class="li" ><div class="sol_list_div"><a href="#" target="sportakisim" class="liste" title="('.$baslik_entry_sayisi.')" >'.$baslik_text.'</a> ';
if($baslik_entry_sayisi>0)
echo '('.$baslik_entry_sayisi.')</div></td>';
'</tr>';
}
Upvotes: 0
Views: 480
Reputation: 3783
Replace
$baslik_text = trim($baslik_text, "\xC2\xA0\n" );
With
$baslik_text = trim($baslik_text);
\xC2\xA0
is the unicode value for non-breaking space. So, if it's a simple space (\x20
) it will not match. See PHP: trim - Manual for more information about the function.
Upvotes: 1