Jump to content

dtdetu

Members
  • Posts

    86
  • Joined

  • Last visited

    Never

Everything posted by dtdetu

  1. hello i get content of a page with curl i and i am trying to find if there is a "Your message has been sent to" in the page i use this code but it doesnt work. can u check this. if (preg_match("[Your message has been sent to\!]", $store)) { ... } else { ... }
  2. <?php $sourcestring = file_get_contents("state.htm"); preg_match_all('~<td><a href="profile\.php\?[^"]*"><span style="color:#[^;]+;">([^<]*)</span></a></td>~',$sourcestring,$matches); echo $matches[1][4]; echo "\n"; ?> now when i search a page for my pattern it finds 7 instances, then i can see them with the $matches[1][1],$matches[1][2].... but how can i see them all, i used for but couldnt make it work. $i = 0; foreach ($matches as $val) { $amount = count($val); while($i < $amount) { echo $val[1][$i]); echo "\n"; $count[] += $i; $i ++; } }
  3. thanks nrg_alpha thats what i wanteded
  4. yes it can be anything foo,bar,ashland or dtdetu below code is working but i want the color to be a variable too, it shouldnt be #00FF00; bec it changes also so we need to change the pattern again. but how:) <?php $sourcestring="your source string"; preg_match_all('~<td><a href="profile\.php\?[^"]*"><span style="color:#00FF00;">([^<]*)</span></a></td>~',$sourcestring,$matches); echo "<pre>".print_r($matches,true); ?>
  5. hey ddrudik thanks for the code it works as i want (the first one), but also the color value changes in everytime like x and y so what is the new pattern, also how can i get ashland without an array , i mean that outputs array , how to make it print only ashland, thanks
  6. hello i want to get ashland with preg_match_all function from the below code but couldnt find the right pattern to use , can anyone check this. <td><a href="profile.php?x=26&y=1&selected=ashland"><span style="color:#00FF00;">ashland</span></a></td>
×
×
  • 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.