Jump to content

Quantcast REGEX HELP


weina67

Recommended Posts

so I'm having so much trouble understanding preg_match. I'm trying to use curl to request data from quantcast.com for sites like google.com and then use php to parse the html output. For example, the html embodies the following:

 

<tbody> <tr class="current "> <td class="title"> <a href="/digg.com"> digg.com </a> </td> <td class="reach digit"> 12.6M <p class="label"> Monthly US People</p> </td> 

 

How do I parse the code to get the 12.6M Month US People? I want to get the "12.6" from the html code above. What preg regular expression should I use? I'm so confused! Anyone who could help, I would be so grateful. Thanks

 

Just to clarify ...

 

I wanted to use preg_match. Like parse the code

$regexp = '#<td class="reach digit">(.*?)</td>#si'; preg_match($regexp, $response, $matches);

to get the 12.6M. But I keep using the wrong regular expression so $matches arrays remains empty.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.