beermaker74 Posted February 28, 2007 Share Posted February 28, 2007 ok i have a query to the google base and i am using curl to get the response. ok if i have dom load (something.xml) it works fine. but if i try and put the var from curl in there it breaks. says itis empty in my error. what do i need to do to load it in the dom so i can parse it? thanks $url ='http://google.com/base/feeds/snippets/-/housing?bq=rental+%5blocation:@%22athens,AL%22%2b50mi%5d&max-results=6'; $c = curl_init($url); curl_setopt($c, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($c); curl_close($c); $dom = new DomDocument; $dom->load("$response"); foreach ($dom->documentElement->childNodes as $books) { if (($books->nodeType == 1) && ($books->nodeName == "entry")) { foreach ($books->childNodes as $theBook) { if (($theBook->nodeType == 1) && ($theBook->nodeName == "id")) { $id = $theBook->textContent; } if (($theBook->nodeType == 1) && ($theBook->nodeName == "published")) { $published = $theBook->textContent; } Link to comment https://forums.phpfreaks.com/topic/40496-using-curl-var-in-dom-load/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.