Monday 15 August 2011

PHP how to Read URL and Modify the contents -


I want to read a URL like Google, and am amending the HTML tag value.

  $ Homepage = file_get_contents ('http://www.google.com'); Echo $ home; For example, after reading the Google link, I should set Google search box value to  Hello word , such as some  & lt; Input type = 'text' value = 'hello world' / & gt;  

Then display the modified page.

How to do this in php, thank you very much

$ Homepage will need to modify the content of the variable what file_get_contents stores the contents of the file as a string.

So you have to look at the text box identifier and use the string function to add a value to the text box.

After this you will echo the modified $ homepage variable.

Take a look at the string functions here:

And especially in this:

If you want to see the string of code actually working, then do this at the beginning of your file:

  Header ('Content-Type: Text / Plain'); $ Homepage = file_get_contents ('http://www.google.com'); Echo $ home;  

No comments:

Post a Comment