Hello everyone!!!
well I just want to know how can I replace the html code of a given webpage.
Like I want to change the code of a webpage whos address is http://www.xyz.com/abc.html
now i would like to change some code in it, to a different one....
can you give me the script for that {suppose the script is change.php
i would like to use it like this http://www.mysite.com/change.php?www.xyz.com/abc.html
i want outpur same as of http://www.xyz.com/abc.html, but with specific changes that i have coded in change.php
Thanks in Advance
Arjun Gupta
arjunetal@gmail.com
Replace HTML code of a webpage with PHP
Moderator: General Moderators
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: Replace HTML code of a webpage with PHP
Thats a very broad question. What have you tried so far?
Lets start simple. The first step is fetching the page contents, and I would recommend using cURL for this.
Lets start simple. The first step is fetching the page contents, and I would recommend using cURL for this.
Code: Select all
$url = 'http://some_page_you_want_to_visit.com';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); //retrive output and do not display it
$content = curl_exec($ch);