php - Warning: file_get_contents() expects parameter 1 to be a valid path, array given 16 -
i have got problem script, i'm trying connect each url each array, got warnings. warning: file_get_contents() expects parameter 1 valid path, array given: in /home/myusername/public_html/simple_html_dom.php on line 78
here line 78 simple_html_dom.php:
$contents = file_get_contents($url, $use_include_path, $context, $offset);
here output:
warning: file_get_contents() expects parameter 1 valid path, array given in /home/myusername/public_html/simple_html_dom.php on line 78 warning: file_get_contents() expects parameter 1 valid path, array given in /home/ytestbox/public_html/simple_html_dom.php on line 78 warning: file_get_contents() expects parameter 1 valid path, array given in /home/myusername/public_html/simple_html_dom.php on line 78 warning: file_get_contents() expects parameter 1 valid path, array given in /home/myusername/public_html/simple_html_dom.php on line 78 warning: file_get_contents() expects parameter 1 valid path, array given in /home/myusername/public_html/simple_html_dom.php on line 78 warning: file_get_contents() expects parameter 1 valid path, array given in /home/myusername/public_html/simple_html_dom.php on line 78 warning: file_get_contents() expects parameter 1 valid path, array given in /home/myusername/public_html/simple_html_dom.php on line 78 warning: file_get_contents() expects parameter 1 valid path, array given in /home/myusername/public_html/simple_html_dom.php on line 78 warning: file_get_contents() expects parameter 1 valid path, array given in /home/myusername/public_html/simple_html_dom.php on line 78 warning: file_get_contents() expects parameter 1 valid path, array given in /home/myusername/public_html/simple_html_dom.php on line 78 warning: file_get_contents() expects parameter 1 valid path, array given in /home/myusername/public_html/simple_html_dom.php on line 78 warning: file_get_contents() expects parameter 1 valid path, array given in /home/myusername/public_html/simple_html_dom.php on line 78 warning: file_get_contents() expects parameter 1 valid path, array given in /home/myusername/public_html/simple_html_dom.php on line 78 warning: file_get_contents() expects parameter 1 valid path, array given in /home/myusername/public_html/simple_html_dom.php on line 78 warning: file_get_contents() expects parameter 1 valid path, array given in /home/myusername/public_html/simple_html_dom.php on line 78 warning: file_get_contents() expects parameter 1 valid path, array given in /home/myusername/public_html/simple_html_dom.php on line 78
here php:
<?php ini_set('max_execution_time', 300); $errmsg_arr = array(); $errflag = false; $link; include ('simple_html_dom.php'); $base1 = "http://www.mysite.com/get-listing.php"; $html = file_get_html($base1); $xml .= "<?xml version='1.0' encoding='utf-8' ?>"; $xml .= ' <tv generator-info-name="www.testbox.elementfx.com/test">'; echo $xml; $links = $html->find('p[id=links] a'); foreach ($links $element) { //open each url in each array $urls[] = $link->href; $url = $urls; $data = file_get_html($url); echo $data; } } ?>
can please tell me how can connect each url each array when list of urls get-listing.php using simple_html_dom?
edit: here result:
string(72) "http://www.mysite.com/get-listing.php?channels=abc family&id=101" string(65) "http://www.mysite.com/get-listing.php?channels=cbs&id=102" string(69) "http://www.mysite.com/get-listing.php?channels=cnn usa&id=103" string(70) "http://www.mysite.com/get-listing.php?channels=espn usa&id=105" string(70) "http://www.mysite.com/get-listing.php?channels=fox news&id=106" string(75) "http://www.mysite.com/get-listing.php?channels=animal planet&id=107" string(73) "http://www.mysite.com/get-listing.php?channels=usa network&id=108" string(67) "http://www.mysite.com/get-listing.php?channels=spike&id=110" string(71) "http://www.mysite.com/get-listing.php?channels=bravo usa&id=111" string(68) "http://www.mysite.com/get-listing.php?channels=bravo1&id=112" string(68) "http://www.mysite.com/get-listing.php?channels=bravo2&id=113" string(68) "http://www.mysite.com/get-listing.php?channels=bravo3&id=114" string(68) "http://www.mysite.com/get-listing.php?channels=bravo4&id=115" string(68) "http://www.mysite.com/get-listing.php?channels=bravo5&id=116" string(68) "http://www.mysite.com/get-listing.php?channels=bravo6&id=117" string(68) "http://www.mysite.com/get-listing.php?channels=bravo7&id=118"
i don't know why saving urls in array since seems want open them can change this
$urls[] = $link->href; $url = $urls;
into this
$urls[] = $url = $link->href;
edit: mind using $urls[] = ...
construct appending existing array. wanted following:
foreach ($links $element) { //open each url in each array $urls = $link->href; foreach ($urls $url) { $data = file_get_html($url); echo $data; } }
Comments
Post a Comment