I want to get the contents of the src attribute of an <img> tag. Here is the code I'm using:
require_once( 'simple_html_dom.php');
$curl = curl_init(); 
curl_setopt($curl, CURLOPT_URL, $webpage);  
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);  
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10);  
$str = curl_exec($curl);  
curl_close($curl);  
if( $str )
{
    $html= str_get_html($str);
    $img = $html->find('img', 0); // get the first image on the page
    $src = $img->src; // get the contents of the img src - but it doesn't seem to work
}
What am I doing wrong?
                        
You are missing a first
'in the first line!!!Replace:
With: