Help with PHP simplehtmldom - Modifiying a form.

Posted by onemyndseye on Stack Overflow See other posts from Stack Overflow or by onemyndseye
Published on 2010-05-01T15:24:36Z Indexed on 2010/05/01 15:27 UTC
Read the original article Hit count: 284

Filed under:
|
|

Ive gotten some great help here and I am so close to solving my problem that I can taste it. But I seem to be stuck.

I need to scrape a simple form from a local webserver and only return the lines that match a users local email (i.e. onemyndseye@localhost). simplehtmldom makes easy work of extracting the correct form element:

foreach($html->find('form[action*="delete"]') as $form) echo $form;

Returns:

<form action="/delete" method="post">
    <input type="checkbox" id="D1" name="D1" /><a href="http://www.linux.com/rss/feeds.php">
        http://www.linux.com/rss/feeds.php
    </a> [email: 
        onemyndseye@localhost (Default)
    ]<br />         
    <input type="checkbox" id="D2" name="D2" /><a href="http://www.ubuntu.com/rss.xml">
        http://www.ubuntu.com/rss.xml
    </a> [email: 
        onemyndseye@localhost (Default)
    ]<br />         

However I am having trouble making the next step. Which is returning lines that contain 'onemyndseye@localhost' and removing it so that only the following is returned:

<input type="checkbox" id="D1" name="D1" /><a href="http://www.linux.com/rss/feeds.php">http://www.linux.com/rss/feeds.php</a> <br />
<input type="checkbox" id="D2" name="D2" /><a href="http://www.ubuntu.com/rss.xml">http://www.ubuntu.com/rss.xml</a> <br />

Thanks to the wonderful users of this site Ive gotten this far and can even return just the links but I am having trouble getting the rest... Its important that the complete <input> tags are returned EXACTLY as shown above as the id and name values will need to be passed back to the original form in post data later on.

Thanks in advance!

© Stack Overflow or respective owner

Related posts about php

Related posts about scrape