Parsing through PHP, echo not working -


i'm trying parse html php document upload web host. when try (with last echo in there see if works):

<?php //a url want retrieve $my_url = 'http://pointstreak.com/prostats/standings.html?leagueid=49&seasonid=12983'; $html = file_get_contents($my_url); $dom = new domdocument(); $dom->loadhtml($html); $xpath = new domxpath($dom);  //put xpath query here $my_xpath_query = "//div[@id='statscontainer']/table/tr/td/table[@class='tablelines']/tr/td"; $result_rows = $xpath->query($my_xpath_query);  // create array hold content of nodes $standingsarray = array();  //here loop through our results (a domdocument object) foreach ($result_rows $result_object){     $standingsarray[] = $result_object->childnodes->item(0)->nodevalue; }  // remove first 12 observations $standingsarray (table headers) ($i = 0; $i < 12; $i++) {     unset($standingsarray[0]);     $standingsarray = array_values($results_rows); }  // remove 12 observations @ index 96 (table headers) ($i = 0; $i < 12; $i++) {     unset($standingsarray[96]);     $standingsarray = array_values($results_rows); }  foreach ($standingsarray $arrayvalue) {     echo $arrayvalue; }  echo “heyhey”;  ?> 

the output on webpage is: “heyheyâ€

however, if change line

foreach ($standingsarray $arrayvalue) {         echo $arrayvalue;     } 

to:

foreach ($standingsarray $arrayvalue) {         echo "$arrayvalue";     } 

then "“heyheyâ€" goes away , have blank webpage.

try this,

foreach ($standingsarray $arrayvalue)  {     echo utf8_encode($arrayvalue); } 

update:

"heyhey" seems different font, try removing/replacing normal text.


Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -