Re: [PHP] Website preview script
On 1 Mar 2012, at 03:06, Nibin V M wrote: But what my requirement here is, I need to display the website configured on our server. No matter where the domain actually points to :) Perhaps it can call a proxyhere is the actual intention of creating this script. Suppose X created a new website on serverA, but the domain actually pointing to ServerB. So to test his new website on ServerA, he either has to edit hosts file or use serverA/~user. I don't want him not to use either method. I would like to provide him a PHP feature on my control panel says site preview through which he can view his website on serverA. Its just like a website preview option in plesk control panel :) I think you're looking at this problem from completely the wrong angle. Why does the preview need to sit under their domain name? If that's really what you want then you have no option but to do something very very clunky with their hosts file, or take over their DNS lookup which is just pure evil and will have huge side effects and security implications. Why can't you simply set the virtual host for their site so it responds to two domain names. Firstly their actual domain name, and secondly something like theirdomain.com.preview.techsware.in (this would be *.preview.techsware.in in your zone file). That way they just need to visit http://theirdomain.com.preview.techsware.in/ and they'll see their website. Simples. -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Website preview script
Hello, I am very new to PHP coding. I am trying to achieve a task via PHP, regarding which I have been googling around for a few days and now come up with emtpy hands! Ok, what I need to write is a website preview script. That is I need to display a website hosted on serverA and pointing elsewhere, from ServerA ( via curl possibly ). For example: I have configured techsware.in and google.com on ServerA ( of course google.com pointing to their IP ). I need to display the contents of google.com on my server , if I call http://techsware.in/google.php which has some curl coding in it! Note, what I have is the domain name ( google.com ) and the IP on which it is hosted on serverA to achieve this. Any way to achieve this? I can achieve this if I put my IP google.com in /etc/hosts file ( its Linux ). But I need to run this script for normal users as well, which won't have super user privileges and thus unable to edit /etc/hosts file. So I want to specify somewhere in the PHP script that, google.com points to my IP. I can do this with this little script. # cat curl.php ?php $curl = curl_init(); curl_setopt ($curl, CURLOPT_URL, http://mytest.com;); curl_exec ($curl); curl_close ($curl); ? Hope someone from this forum will come back a solution [image: :)] PS: web server is apache and php version is 5.2 Thank you, -- Regards Nibin. http://TechsWare.in
Re: [PHP] Website preview script
On Wed, Feb 29, 2012 at 7:07 PM, Nibin V M nibi...@gmail.com wrote: Hello, I am very new to PHP coding. I am trying to achieve a task via PHP, regarding which I have been googling around for a few days and now come up with emtpy hands! Ok, what I need to write is a website preview script. That is I need to display a website hosted on serverA and pointing elsewhere, from ServerA ( via curl possibly ). For example: I have configured techsware.in and google.com on ServerA ( of course google.com pointing to their IP ). I need to display the contents of google.com on my server , if I call http://techsware.in/google.php which has some curl coding in it! Note, what I have is the domain name ( google.com ) and the IP on which it is hosted on serverA to achieve this. Any way to achieve this? I can achieve this if I put my IP google.com in /etc/hosts file ( its Linux ). But I need to run this script for normal users as well, which won't have super user privileges and thus unable to edit /etc/hosts file. So I want to specify somewhere in the PHP script that, google.com points to my IP. I can do this with this little script. How about just doing a str_replace[1]? - Matijn [1]http://www.php.net/str_replace -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Website preview script
On Wed, 2012-02-29 at 19:29 +0100, Matijn Woudt wrote: On Wed, Feb 29, 2012 at 7:07 PM, Nibin V M nibi...@gmail.com wrote: Hello, I am very new to PHP coding. I am trying to achieve a task via PHP, regarding which I have been googling around for a few days and now come up with emtpy hands! Ok, what I need to write is a website preview script. That is I need to display a website hosted on serverA and pointing elsewhere, from ServerA ( via curl possibly ). For example: I have configured techsware.in and google.com on ServerA ( of course google.com pointing to their IP ). I need to display the contents of google.com on my server , if I call http://techsware.in/google.php which has some curl coding in it! Note, what I have is the domain name ( google.com ) and the IP on which it is hosted on serverA to achieve this. Any way to achieve this? I can achieve this if I put my IP google.com in /etc/hosts file ( its Linux ). But I need to run this script for normal users as well, which won't have super user privileges and thus unable to edit /etc/hosts file. So I want to specify somewhere in the PHP script that, google.com points to my IP. I can do this with this little script. How about just doing a str_replace[1]? - Matijn [1]http://www.php.net/str_replace Why can't you use an iframe, or are you trying to offer this other websites content as if it were on your own site? If so, I would first check to see if you're actually allowed to do that, as that will bring up quite a few copyright issues otherwise, which can be very expensive. -- Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Website preview script
No..what I am trying to write a website preview plugin attached to a control panel.. :) since I am a newbie, I don't know how to achieve this without modifying hosts file ( I am basically a linux sys admin ) :) @Martin - I will check it. Since I am a beginner ( of course, just started to learn PHP today ) I need to start from scratch. If yo could provide some sample code, it will be great :) thanks for your input guys.. On Thu, Mar 1, 2012 at 12:11 AM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: ** On Wed, 2012-02-29 at 19:29 +0100, Matijn Woudt wrote: On Wed, Feb 29, 2012 at 7:07 PM, Nibin V M nibi...@gmail.com wrote: Hello, I am very new to PHP coding. I am trying to achieve a task via PHP, regarding which I have been googling around for a few days and now come up with emtpy hands! Ok, what I need to write is a website preview script. That is I need to display a website hosted on serverA and pointing elsewhere, from ServerA ( via curl possibly ). For example: I have configured techsware.in and google.com on ServerA ( of course google.com pointing to their IP ). I need to display the contents of google.com on my server , if I call http://techsware.in/google.php which has some curl coding in it! Note, what I have is the domain name ( google.com ) and the IP on which it is hosted on serverA to achieve this. Any way to achieve this? I can achieve this if I put my IP google.com in /etc/hosts file ( its Linux ). But I need to run this script for normal users as well, which won't have super user privileges and thus unable to edit /etc/hosts file. So I want to specify somewhere in the PHP script that, google.com points to my IP. I can do this with this little script. How about just doing a str_replace[1]? - Matijn [1]http://www.php.net/str_replace Why can't you use an iframe, or are you trying to offer this other websites content as if it were on your own site? If so, I would first check to see if you're actually allowed to do that, as that will bring up quite a few copyright issues otherwise, which can be very expensive. -- Thanks, Ash http://www.ashleysheridan.co.uk -- Regards Nibin. http://TechsWare.in
Re: [PHP] Website preview script
Hi, Nibin I wonder what you'd call a website preview ... Do you mean a screenshot or the HTML-response from the server, specially prepared (sounds like you want to create a proxy ;))? Bye Simon 2012/2/29 Nibin V M nibi...@gmail.com No..what I am trying to write a website preview plugin attached to a control panel.. :) since I am a newbie, I don't know how to achieve this without modifying hosts file ( I am basically a linux sys admin ) :) @Martin - I will check it. Since I am a beginner ( of course, just started to learn PHP today ) I need to start from scratch. If yo could provide some sample code, it will be great :) thanks for your input guys.. On Thu, Mar 1, 2012 at 12:11 AM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: ** On Wed, 2012-02-29 at 19:29 +0100, Matijn Woudt wrote: On Wed, Feb 29, 2012 at 7:07 PM, Nibin V M nibi...@gmail.com wrote: Hello, I am very new to PHP coding. I am trying to achieve a task via PHP, regarding which I have been googling around for a few days and now come up with emtpy hands! Ok, what I need to write is a website preview script. That is I need to display a website hosted on serverA and pointing elsewhere, from ServerA ( via curl possibly ). For example: I have configured techsware.in and google.com on ServerA ( of course google.com pointing to their IP ). I need to display the contents of google.com on my server , if I call http://techsware.in/google.phpwhich has some curl coding in it! Note, what I have is the domain name ( google.com ) and the IP on which it is hosted on serverA to achieve this. Any way to achieve this? I can achieve this if I put my IP google.com in /etc/hosts file ( its Linux ). But I need to run this script for normal users as well, which won't have super user privileges and thus unable to edit /etc/hosts file. So I want to specify somewhere in the PHP script that, google.compoints to my IP. I can do this with this little script. How about just doing a str_replace[1]? - Matijn [1]http://www.php.net/str_replace Why can't you use an iframe, or are you trying to offer this other websites content as if it were on your own site? If so, I would first check to see if you're actually allowed to do that, as that will bring up quite a few copyright issues otherwise, which can be very expensive. -- Thanks, Ash http://www.ashleysheridan.co.uk -- Regards Nibin. http://TechsWare.in
Re: [PHP] Website preview script
On Wed, 2012-02-29 at 19:54 +0100, Simon Schick wrote: Hi, Nibin I wonder what you'd call a website preview ... Do you mean a screenshot or the HTML-response from the server, specially prepared (sounds like you want to create a proxy ;))? Bye Simon 2012/2/29 Nibin V M nibi...@gmail.com No..what I am trying to write a website preview plugin attached to a control panel.. :) since I am a newbie, I don't know how to achieve this without modifying hosts file ( I am basically a linux sys admin ) :) @Martin - I will check it. Since I am a beginner ( of course, just started to learn PHP today ) I need to start from scratch. If yo could provide some sample code, it will be great :) thanks for your input guys.. On Thu, Mar 1, 2012 at 12:11 AM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: ** On Wed, 2012-02-29 at 19:29 +0100, Matijn Woudt wrote: On Wed, Feb 29, 2012 at 7:07 PM, Nibin V M nibi...@gmail.com wrote: Hello, I am very new to PHP coding. I am trying to achieve a task via PHP, regarding which I have been googling around for a few days and now come up with emtpy hands! Ok, what I need to write is a website preview script. That is I need to display a website hosted on serverA and pointing elsewhere, from ServerA ( via curl possibly ). For example: I have configured techsware.in and google.com on ServerA ( of course google.com pointing to their IP ). I need to display the contents of google.com on my server , if I call http://techsware.in/google.phpwhich has some curl coding in it! Note, what I have is the domain name ( google.com ) and the IP on which it is hosted on serverA to achieve this. Any way to achieve this? I can achieve this if I put my IP google.com in /etc/hosts file ( its Linux ). But I need to run this script for normal users as well, which won't have super user privileges and thus unable to edit /etc/hosts file. So I want to specify somewhere in the PHP script that, google.compoints to my IP. I can do this with this little script. How about just doing a str_replace[1]? - Matijn [1]http://www.php.net/str_replace Why can't you use an iframe, or are you trying to offer this other websites content as if it were on your own site? If so, I would first check to see if you're actually allowed to do that, as that will bring up quite a few copyright issues otherwise, which can be very expensive. -- Thanks, Ash http://www.ashleysheridan.co.uk -- Regards Nibin. http://TechsWare.in It does sound more like a proxy than a preview script. What about using something like this: http://uk3.php.net/manual/en/function.imagegrabscreen.php I've never used it, but on first appearances it looks like it should produce the preview you require. -- Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Website preview script
Hi, Ashley The question is what this function does ;) I think it really takes a screenshot of the server - whatever is shown there right now. But how to get a browser running there in full-screen? I came around that post for a couple of weeks ago and thought it could be useful for someone here: http://www.phpgangsta.de/screenshots-von-webseiten-erstellen-mit-php Bye Simon 2012/2/29 Ashley Sheridan a...@ashleysheridan.co.uk ** On Wed, 2012-02-29 at 19:54 +0100, Simon Schick wrote: Hi, Nibin I wonder what you'd call a website preview ... Do you mean a screenshot or the HTML-response from the server, specially prepared (sounds like you want to create a proxy ;))? Bye Simon 2012/2/29 Nibin V M nibi...@gmail.com No..what I am trying to write a website preview plugin attached to a control panel.. :) since I am a newbie, I don't know how to achieve this without modifying hosts file ( I am basically a linux sys admin ) :) @Martin - I will check it. Since I am a beginner ( of course, just started to learn PHP today ) I need to start from scratch. If yo could provide some sample code, it will be great :) thanks for your input guys.. On Thu, Mar 1, 2012 at 12:11 AM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: ** On Wed, 2012-02-29 at 19:29 +0100, Matijn Woudt wrote: On Wed, Feb 29, 2012 at 7:07 PM, Nibin V M nibi...@gmail.com wrote: Hello, I am very new to PHP coding. I am trying to achieve a task via PHP, regarding which I have been googling around for a few days and now come up with emtpy hands! Ok, what I need to write is a website preview script. That is I need to display a website hosted on serverA and pointing elsewhere, from ServerA ( via curl possibly ). For example: I have configured techsware.in and google.com on ServerA ( of course google.com pointing to their IP ). I need to display the contents of google.com on my server , if I call http://techsware.in/google.phpwhich has some curl coding in it! Note, what I have is the domain name ( google.com ) and the IP on which it is hosted on serverA to achieve this. Any way to achieve this? I can achieve this if I put my IP google.com in /etc/hosts file ( its Linux ). But I need to run this script for normal users as well, which won't have super user privileges and thus unable to edit /etc/hosts file. So I want to specify somewhere in the PHP script that, google.compoints to my IP. I can do this with this little script. How about just doing a str_replace[1]? - Matijn [1]http://www.php.net/str_replace Why can't you use an iframe, or are you trying to offer this other websites content as if it were on your own site? If so, I would first check to see if you're actually allowed to do that, as that will bring up quite a few copyright issues otherwise, which can be very expensive. -- Thanks, Ash http://www.ashleysheridan.co.uk -- Regards Nibin. http://TechsWare.in It does sound more like a proxy than a preview script. What about using something like this: http://uk3.php.net/manual/en/function.imagegrabscreen.php I've never used it, but on first appearances it looks like it should produce the preview you require. -- Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Website preview script
HI all, But what my requirement here is, I need to display the website configured on our server. No matter where the domain actually points to :) Perhaps it can call a proxyhere is the actual intention of creating this script. Suppose X created a new website on serverA, but the domain actually pointing to ServerB. So to test his new website on ServerA, he either has to edit hosts file or use serverA/~user. I don't want him not to use either method. I would like to provide him a PHP feature on my control panel says site preview through which he can view his website on serverA. Its just like a website preview option in plesk control panel :) On Thu, Mar 1, 2012 at 1:25 AM, Simon Schick simonsimc...@googlemail.comwrote: Hi, Ashley The question is what this function does ;) I think it really takes a screenshot of the server - whatever is shown there right now. But how to get a browser running there in full-screen? I came around that post for a couple of weeks ago and thought it could be useful for someone here: http://www.phpgangsta.de/screenshots-von-webseiten-erstellen-mit-php Bye Simon 2012/2/29 Ashley Sheridan a...@ashleysheridan.co.uk ** On Wed, 2012-02-29 at 19:54 +0100, Simon Schick wrote: Hi, Nibin I wonder what you'd call a website preview ... Do you mean a screenshot or the HTML-response from the server, specially prepared (sounds like you want to create a proxy ;))? Bye Simon 2012/2/29 Nibin V M nibi...@gmail.com No..what I am trying to write a website preview plugin attached to a control panel.. :) since I am a newbie, I don't know how to achieve this without modifying hosts file ( I am basically a linux sys admin ) :) @Martin - I will check it. Since I am a beginner ( of course, just started to learn PHP today ) I need to start from scratch. If yo could provide some sample code, it will be great :) thanks for your input guys.. On Thu, Mar 1, 2012 at 12:11 AM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: ** On Wed, 2012-02-29 at 19:29 +0100, Matijn Woudt wrote: On Wed, Feb 29, 2012 at 7:07 PM, Nibin V M nibi...@gmail.com wrote: Hello, I am very new to PHP coding. I am trying to achieve a task via PHP, regarding which I have been googling around for a few days and now come up with emtpy hands! Ok, what I need to write is a website preview script. That is I need to display a website hosted on serverA and pointing elsewhere, from ServerA ( via curl possibly ). For example: I have configured techsware.in and google.com on ServerA ( of course google.com pointing to their IP ). I need to display the contents of google.com on my server , if I call http://techsware.in/google.phpwhich has some curl coding in it! Note, what I have is the domain name ( google.com ) and the IP on which it is hosted on serverA to achieve this. Any way to achieve this? I can achieve this if I put my IP google.com in /etc/hosts file ( its Linux ). But I need to run this script for normal users as well, which won't have super user privileges and thus unable to edit /etc/hosts file. So I want to specify somewhere in the PHP script that, google.compoints to my IP. I can do this with this little script. How about just doing a str_replace[1]? - Matijn [1]http://www.php.net/str_replace Why can't you use an iframe, or are you trying to offer this other websites content as if it were on your own site? If so, I would first check to see if you're actually allowed to do that, as that will bring up quite a few copyright issues otherwise, which can be very expensive. -- Thanks, Ash http://www.ashleysheridan.co.uk -- Regards Nibin. http://TechsWare.in It does sound more like a proxy than a preview script. What about using something like this: http://uk3.php.net/manual/en/function.imagegrabscreen.php I've never used it, but on first appearances it looks like it should produce the preview you require. -- Thanks, Ash http://www.ashleysheridan.co.uk -- Regards Nibin. http://TechsWare.in