Lexicon Posted December 8, 2010 Share Posted December 8, 2010 I'm trying to work on my php skills by creating an online content "finder". I'm using cURL to grab webpage HTML and store it in a variable. I then want my program to find the article title, keywords and the content. I'm using articles from Ezine. here is an example webpage. http://ezinearticles.com/?8-Ways-to-Reduce-Stock-Investment-Risks&id=954266 I don't have any problems grabbing the webpage html. But when I try to grab the title, keywords, and content using this code. $title = getbetween($html, "<title>", "</title>"); $keywords = getbetween($html, "<meta name=\"keywords\" content=\"", "\">"); $content = getbetween($html, "<div id=\"body\">", "</div>"); $content = "<P>" . getbetween($content . "<E>", "<P>", "<E>"); echo "Title: " . $title . "<P>"; echo "Keywords: " . $keywords . "<P>"; echo "Content: " . $content . "<P>"; Only the title comes out of the page, the rest of the values are blank... I'm not sure why the getbetween is only working to extract the title from the html. Does anyone have any ideas why?? I tried testing to see if it was grabbing the propper webpage and when I used 'echo $html;' the webpage came out fine on my page.. I am totally lost on this, I just want to practice using cURL and my webrequest coding. Thanks for any help, I appreciate it. Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted December 8, 2010 Share Posted December 8, 2010 what is getbetween? Quote Link to comment Share on other sites More sharing options...
Lexicon Posted December 9, 2010 Author Share Posted December 9, 2010 It's just a function to get the string in between two certain values in a string. $string = "atoz"; echo getbetween($string, "a", "z"); //echoes "to" Quote Link to comment Share on other sites More sharing options...
Lexicon Posted December 9, 2010 Author Share Posted December 9, 2010 never mind, it's a matter of my getbetween function not working correctly. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.