simple html dom - Issue in Passing Url in PHP -
I am doing some operations in the URL below.
$ paginationPages = array (); $ ProductCount = intval ($ htmlProductPage- & gt; Search ('div.paging span.itemcount', 0) -> plain text); If ($ ProductCount / 16 & gt; 1) {$ pagecount = ceil ($ ProductCount / 16); For ($ i = 2; $ i & lt; = $ PageCount; $ i ++) {$ urlSplitArray = Explosion ('.', $ ProductUrl); $ UrlSplitCount = Count ($ urlSplitArray); $ UrlSplitArray [$ urlSplitCount-2] = "[" $ i .. "]". $ Endorsement page [] = intestine ('.', $ UrlSplitArray). "& Lt; br & gt;"; } #print_r ($ paging page); } and I'm getting all the links in the foreach to proceed
foreach ($ paginationPages page $ next URL) {# $ nextUrl = " Http: //www.100percent.co.nz/kitchen-and-cooking/ovens/freestanding[2].htm "; $ HtmlProductPage = file_get_html ($ nextUrl); Foreach ($ htmlProductPage- & gt; Find ("div.Item") as $ element) {// error is here $ element-> External text; I am unable to find the element div.Item when I pass the link dynamically but when I put the URL directly inside the loop , Then I could find the same element. Why is this happening?
The problem is causing this statement:
$ Endorsing page [] = implode ('.', $ UrlSplitArray). "& Lt; br & gt;"; Print code $ pages on page : array ([0] => http: // www. 100percent.co You are tagging the & lt; br & gt; element. NG / Kitchen-and-Pak / Oven / Freestanding [2] .htm & lt; br & gt; End of page name, which means that the page can not be retrieved from this code: foreach ($ nextUrl as $ paginationPages) {$ HtmlProductPage = file_get_html ($ nextUrl); I suggest adding a check that file_get_html has scraped the content A page before parsing the page is successfully retrieved.
Comments
Post a Comment