php – count number of times a word appears in a webpage pulled using fopen and fpassthru

Another question:
Here’s my code atm:

$fp = fopen("https://********", 'r', false, $context);
fpassthru($fp);
fclose($fp);

$tmp = count_values($fp);
$cnt = $tmp[typelabel];
echo $cnt;

I want this code to count the number of times the word ‘typelabel’ appears in the variable $fp. I believe the count function only works on arrays, so any ideas? Also, would this work if I didnt print out the page contents (if i removed fpassthru?)
Thanks

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s