php: array to string conversion

Eric C eric at newmag.org
Wed Apr 11 10:41:27 EDT 2007


hi all.  in the middle of my script for scraping
bittorrent trackers i'm getting 'Notice: Array to
string conversion'.  i'm trying to use curl to get the
text from the tracker and then i want to extract the
desired text and update the database.  preg_match and
substr look like an easy way to get the digits but can
i not use them together?  i tried using settype but
keep screwing up.  thanks for any tips.  - eric c, the
one who sucks at programming but wants new toys.

...

// let's extract complete (seeds), downloaded and
incomplete (peers).
preg_match("<completei\d*>", $scrape_result,
$matches_complete);
preg_match("<downloadedi\d*>", $scrape_result,
$matches_downloaded);
preg_match("<incompletei\d*>", $scrape_result,
$matches_incomplete);

// get the substring of only numbers
$complete = substr($matches_complete, 9);
$downloads = substr($matches_downloaded, 11);
$incomplete = substr($matches_incomplete, 11);

...

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.




More information about the Discuss mailing list