How do I put the contents of a web page into an xml parser?

I want to put the contents of a web page into an xml parser so that it will be easier to grab just the info I need.  Is there a way to do this?  The code I'm using to grab a web page is below.
$url = "";
$str = file_get_contents($url);
function get_url_contents($url){
        $crl = curl_init();
        $timeout = 15;
        curl_setopt ($crl, CURLOPT_URL,$url);
        curl_setopt ($crl, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt ($crl, CURLOPT_CONNECTTIMEOUT, $timeout);
        $ret = curl_exec($crl);
        return $ret;

Open in new window

Who is Participating?
musicmasteriaConnect With a Mentor Commented:
Does this function look like something you might need?
$xml = simplexml_load_file($url);

That will create a object/array of all the xml values on $url and put them in $xml
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.