We help IT Professionals succeed at work.

PHP to screen scrape

leezac
leezac used Ask the Experts™
on
Is there a way to do the following using PHP?

  I need the script to look for the values as they will be different each time from the URL that is entered into the textbox.

1. User enters url where they want to get the values from
2. Code searches for values and displays on same page as the textbox for the url.
3. The last piece will be they will need to paste into another url that has the same fields but need the values populated.

It is a copy and paste method.



<INPUT id="url" TYPE="type" NAME="name" size="60"
size="size"maxlength="maxlength" />



This an example that is from the page I need to copy from:
                                                                       
<label for="summary">Summary<span class="aui-icon icon-required"></span><span class="content">Required</span></label>
                <input class="text long-field" id="summary" maxlength="255" name="summary" type="text" value="new setup" />
                                    </div>
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2011
Top Expert 2016
Commented:
Is there a way to do the following...
Yes.  You can read the HTML of remote web site pages with CURL or file_get_contents().  Then you can use string manipulation functions like regular expressions, explode(), substr(), strpos() to deconstruct the HTML string and extract the information you want.

If you can show us the actual URLs you want to scrape, and show us what information you want to extract it would be easy to write up a simple code example that teaches the principles of operation.

Author

Commented:
I've requested that this question be deleted for the following reason:

Not getting information needed.
Most Valuable Expert 2011
Top Expert 2016

Commented:
I object to deleting this question.  I asked the author to post links to the URLs of the test data and got no response.  We cannot do anything to help unless we can see the data we're working with and the expected outputs.  But if we have that, the community at EE can usually come up with very good answers and sometimes even tested-and-working code samples.