", $row_s);
+ do_log("row_s: $row_s, row_e: $row_e");
$temp = trim(substr ($html, $row_s , $row_e - $row_s));
# $row_x = strpos( $temp, '| ' );
@@ -810,7 +839,7 @@ $responseBody = $response->getBody();
* @return array director (array[0..n] of strings)
*/
function director () {
- if ($this->credits_director == ""){
+ if (empty($this->credits_director)){
if ($this->page["Credits"] == "") $this->openpage ("Credits");
}
$director_rows = $this->get_table_rows($this->page["Credits"], "Directed by");
@@ -854,9 +883,13 @@ $responseBody = $response->getBody();
*/
function cast () {
if ($this->credits_cast == "") {
- if ($this->page["Credits"] == "") $this->openpage ("Credits");
+// if ($this->page["Credits"] == "") $this->openpage ("Credits");
+ if ($this->page["Credits"] == "") $this->openpage ("Title");
}
- $cast_rows = $this->get_table_rows_cast($this->page["Credits"], "Cast");
+// $cast_rows = $this->get_table_rows_cast($this->page["Credits"], "Cast");
+ $cast_rows = $this->get_table_rows($this->page["Title"], "Cast");
+ do_log("cast_rows: " . json_encode($cast_rows));
+// dd($cast_rows);
for ( $i = 0; $i < count ($cast_rows); $i++){
$cels = $this->get_row_cels ($cast_rows[$i]);
if (!isset ($cels[0])) return array();
@@ -882,7 +915,8 @@ $responseBody = $response->getBody();
if ($this->page["Credits"] == "") $this->openpage ("Credits");
}
$this->credits_writing = array();
- $writing_rows = $this->get_table_rows($this->page["Credits"], "Writing credits");
+ $writing_rows = $this->get_table_rows($this->page["Credits"], "Writing Credits");
+ do_log("writing_rows: " . json_encode($writing_rows));
for ( $i = 0; $i < count ($writing_rows); $i++){
$cels = $this->get_row_cels ($writing_rows[$i]);
if ( count ( $cels) > 2){
@@ -936,7 +970,7 @@ $responseBody = $response->getBody();
if ($this->page["Credits"] == "") $this->openpage ("Credits");
}
$this->credits_composer = array();
- $composer_rows = $this->get_table_rows($this->page["Credits"], "Original Music by");
+ $composer_rows = $this->get_table_rows($this->page["Credits"], "Music by");
for ( $i = 0; $i < count ($composer_rows); $i++){
$cels = $this->get_row_cels ($composer_rows[$i]);
if ( count ( $cels) > 2){
@@ -1024,6 +1058,11 @@ $responseBody = $response->getBody();
{
if ($this->main_country == "")
{
+ $result = $this->retrieveFromPage('Country:', '');
+ $result = strip_tags($result);
+ //no need more...
+ return $this->main_country = explode('|', $result);
+
if ($this->page["Title"] == "") $this->openpage ("Title");
$this->main_country = array();
$country_s = strpos($this->page["Title"],"/Sections/Countries/") -5;
@@ -1169,6 +1208,21 @@ $responseBody = $response->getBody();
return $this->main_mpaa;
}
+
+ private function retrieveFromPage($beginDelimiter, $endDelimiter, $page = 'Title')
+ {
+ if (empty($this->page[$page])) {
+ $this->openpage ($page);
+ }
+ $string = utf8_decode($this->page[$page]);
+ $lang_s = mb_strpos ($string, $beginDelimiter, 0, 'utf-8');
+ $lang_e = mb_strpos ($string, $endDelimiter, $lang_s, 'utf-8');
+ $result = mb_substr ($string, $lang_s, $lang_e - $lang_s,'utf-8');
+ $result = str_replace($beginDelimiter, '', $result);
+ do_log("begin: $beginDelimiter, 'end: $endDelimiter, result: $result");
+ return $result;
+ }
+
} // end class imdb
#====================================================[ IMDB Search class ]===
|