ned69 0 Newbie Poster

Hi there,

I am trying to scrap content off a site. I have a couple of working functions, one that scraps the full content which consists mainly of a bulleted list:
# Business Day: Candidates Who Carry a Lot of Clout
# Business Day: Minister Warns Land Reform Beneficiaries
# Business Day: Social Security Agency Sued

and then the other that isolates just the single listings.

Instead of just getting that first list item I want to be able to store each listing as an array element so that I can manipulate that data further. I figure I'm going to need some while loop to do this but since I'm dealing with strings, how would I do:

while($myList.hasnext()){ 
$array[$i] = $currrentListItem;
$i++;
}

Ie how do I iterate through the bullet list and move from bullet to bullet?

Here is the code where I am trying to do this:

<?php 

    include("functions.php");

    $url = "http://thelink.com/sub";  
 
// function scrap is returning full bullet list just fine   
    $content = scrap($url);
 
   
    $start = "<li class=";  
     
    $end = "</a></li>";
    
//scrap_single is returns a bullet at a time but I need to be able to move to the next, then the next then the next
    $list = scrap_single($content, $start, $end);
    
    echo $list;

I'm a newbie to PHP so please excuse me if I'm not clear.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.