0

I have this structure to get data from another webstie

$searchURL = "http://www.anotherwebsite.com";
$html = file_get_contents($searchURL);

$patternform = '/(<tbody.*<\/tbody>)/sm';
preg_match_all($patternform ,$html,$matches);
preg
echo $matches[0][0];


<tr class="even hidden">
        <td colspan="3">OB I</td>
        <td colspan="5">vízilabda, ffi</td>
                </tr>

    <tr class="odd">
        <td class="opener nowrap"><ins></ins>063</td>
        <td class="center nowrap"><ins class="sport jegkorong" title="jégkorong"><span>jégkorong</span></ins>3</td>
        <td><strong>Magyarország - Lengyelország</strong></td>
                        <td class="center">
                                    1.59                                    </td>
            <td class="center">
                                    4.20                                    </td>
            <td class="center">
                                    3.55                                    </td>
                    <td class="nowrap">
                            P 18:15                         </td>
        <td class="nowrap">
                            nov. 08                         </td>
                </tr>

^^ I had this "input"

Question is: How can I change three td value to javascript onclick event (extra: that I want to store the name of the event and I want to store the selected odds and add to new div or table line by line.)

I think preg_replace need but regexp. not my desk.

HamZa
  • 14,671
  • 11
  • 54
  • 75
  • If you don't know regex then don't use it, use a parser. [There's a lot ...](http://stackoverflow.com/questions/3577641/how-do-you-parse-and-process-html-xml-in-php/3577662#3577662) – HamZa Nov 08 '13 at 15:58

1 Answers1

0

Why must javascript be used? Would simply using the HTML onclick work?

<td onclick="SomethingFunky">

jr0207
  • 47
  • 5