Friday, 15 May 2015

curl - PHP webscraper, no output -


I'm trying to make a webcaster for a Denmark wine site.

But I'm having some problems coming out of it. I feel that this is my problem in Xpath- part because I'm leaving some stars with my debugging, but I'm not sure is.

  $ title = $ ScrapedPageXpath- gt; Query ('* * LT; h3 & gt;');  

It may also be that my query is wrong.

I am not a skilled programmer, and I tried to try it for the first time, so please keep in mind your answers.

Below is my code:

  & lt ;? Php function curlGet ($ url) {$ chandle = curl_init (); Curl_setopt ($ Chandel, CURLOPT_URL, $ url); Curl_setopt ($ Chandel, CURLOPT_RETURNTRANSFER, TRUE); Curl_setopt ($ Chandel, CURLOPT_CONNECTTIMEOUT, 5); Curl_setopt ($ Chandel, CURLOPT_FOLLOWLOCATION, 5); $ Curl result = curl_xax ($ sandal); Curl_close ($ chandle); Return curl result; } $ Winelist = array (); Function returnXPathObject ($ item) {$ xmlPageDom = new DomDocument (); @ $ XmlPageDom- & gt; LoadHTML ($ item); $ XmlPageXPath = New DOMXPath ($ xmlPageDom); $ XmlPageXPath; } $ Scrap page = colgate ('http://www.vinhit.dk/shop/'); $ Scrappage Xpath = returnXPathObject ($ scrap page); $ Heading = $ scrap page-path- & gt; Query ('* <-33>;); If ($ title-> Length> 0) {$ Winelist ['title'] = $ title- & gt; Items (0) - & gt; Nodeville; } Print_r ($ Winelist);  

Your query does not have valid XPath expressions all & lt; H3 & gt; To obtain a nodes query: XPath:

      // h3  

    >


No comments:

Post a Comment