Pyro
Guru
- Joined
- Jun 14, 2005
- Sythe Gold
- 0
- Messages
- 1,145
- Age
- 36
Anyone who knows me, knows that I am not just a lazy leecher. I have done my best to figure this out on my own. I have read quite a few tutorials, and have written alot of code. But, I can't figure this out. I am trying to write something to enumerate the list of unread messages on myspace, and get a link to each of them.
Note: This all assumes that the user is already logged in, and the page has been fetched. As if the HTML source code to the Inbox page has already been downloaded, and the PHP code is parsing the downloaded file.
With the following code, I can find out how many unread messages there are. The problem is that I don't know how to match the URL to the message, with the "Unread" text, to make sure that it doesn't get messages that have already been read. I could do this in VB, but I need to write in in a web probramming language, and PHP is the only one I'm any good at.
Note: This all assumes that the user is already logged in, and the page has been fetched. As if the HTML source code to the Inbox page has already been downloaded, and the PHP code is parsing the downloaded file.
With the following code, I can find out how many unread messages there are. The problem is that I don't know how to match the URL to the message, with the "Unread" text, to make sure that it doesn't get messages that have already been read. I could do this in VB, but I need to write in in a web probramming language, and PHP is the only one I'm any good at.
Code:
function str_cnt($find,$in){
$search_for=$find." ";
$count==0;
$string=substr( strstr( $find, $in));
while($string){
$string=substr( strstr( $string, $in));
$count= count + 1;
}
return $count;
}
function message_count(string $url)
{
$contents = file_get_contents($url);
$ret_val=0;
$count = str_cnt("Unread</span>",$contents);
if ($count > 0) {
$ret_val = $count;
}
return $ret_val;
}


