Page 1 of 2
How to display a webpage from another domain in our php page
Posted: Sat Mar 05, 2011 1:41 am
by krieya
Hi,
I just started learning PHP.
I am trying to display a webpage from other domain (eg:
www.google.com) in my PHP page.
I tried "include" function, page is getting loaded however,
Due to the change in absolute path, no functionality is working.
Example: if we search for a string and click on search button, Page Not Found 404 error is getting displayed.
Is there any php function that is equivalent to <iframe> ? So that page gets loaded as it is.
Please suggest me.
Thanks!!
Re: How to display a webpage from another domain in our php
Posted: Sat Mar 05, 2011 9:34 am
by Jonah Bron
Why do you want to do this? Without some major work, you really can't fix all the relative paths. How about just using an <iframe>?
Re: How to display a webpage from another domain in our php
Posted: Sat Mar 05, 2011 12:50 pm
by krieya
If I use Iframe, I am facing cross domain issues.
All that I want to do is, set and get the attributes of an HTML element of a web page from other domain (eg: set value of text field, get value of text field, click button etc)
I know that solution can be derived using browser add ons however it will become a browser specific.
Hence I am trying to get this done using some javascript or some thing stuff like it.
Please suggest the best solution for my problem.
Thanks!
Re: How to display a webpage from another domain in our php
Posted: Sat Mar 05, 2011 5:06 pm
by Jonah Bron
Maybe I could help more if I knew exactly what you were trying to do. Could you explain in more detail?
Re: How to display a webpage from another domain in our php
Posted: Sat Mar 05, 2011 11:34 pm
by krieya
Actually, I am trying to develop a webpage that can assist our daily and routine tasks.
Example:
If we want to login to yahoomail.
First I will create the script to this tasks.
Script looks like:
window.location('http://yahoomail.com');document.getElementId(<id of login text field>).value="user name";document.getElementId(<id of password text field>).value="password";document.getElementId(<id of login button>).click
So I want to load yahoomail.com in my webpage and then run the above script to get me login into my yahoo mail.
Please let me know if there is any possibility in doing the above task.
Thanks!!
Re: How to display a webpage from another domain in our php
Posted: Sun Mar 06, 2011 4:03 pm
by Jonah Bron
Unfortunately, doing that would be very difficult. The effort required would far exceed the trouble of just logging in. Plus it's insecure.
Re: How to display a webpage from another domain in our php
Posted: Sun Mar 06, 2011 11:48 pm
by krieya
Yes, I am slowly understanding that it is very difficult.
Also I have tried browser addons which is the best solution for this however at workplace we should have admin rights to get the addon installed (eg: IMacros addon will get our job done).
However I was just searching with a hope, Is there a way to do this?
Please suggest me If you have any solutions though it is very difficult.
Thanks!!
Re: How to display a webpage from another domain in our php
Posted: Mon Mar 07, 2011 1:05 pm
by Jonah Bron
Why can't you just visit the login page and tell your browser to save the password? I can do it it about 5 seconds flat.
Re: How to display a webpage from another domain in our php
Posted: Tue Mar 08, 2011 5:42 am
by krieya
Yes for login I can do in that way however I am looking at a larger picture.
I want to set and get the attributes of the HTML DOM (like click button, select radio button, set text field etc) which inturn assist daily routine tasks of a web application tester.
Any suggestions on how to access DOM inside IFrame? or any other way to access DOM from other domain?
Thanks!!
Re: How to display a webpage from another domain in our php
Posted: Tue Mar 08, 2011 6:12 am
by VladSun
You may try building a cURL proxy scripts. Cross domain issues will be solved.
http://php.net/manual/en/book.curl.php
And you can put and use the login credentials outside the page because the actual login is performed by your PHP script (i.e. server side).
Re: How to display a webpage from another domain in our php
Posted: Tue Mar 08, 2011 11:21 pm
by krieya
So Using this Client URL Library.
Can we click on buttons, set text field values, select radio buttons?
I am looking to assist the tasks of a web application manual tester which always have routine tasks and static inputs.
(like filling data in text fields, selecting radio buttons, dropdowns, clicking links, buttons etc)
Thanks!!
Re: How to display a webpage from another domain in our php
Posted: Tue Mar 08, 2011 11:47 pm
by matthijs
And what about normal (old style) frames? You can include complete websites that way.
However, I still don't understand the purpose exactly. Are you building a dashboard kind of webpage?
Not sure which websites you're talking about, but most webservices do have some kind of API, which allow you to to things. Like with twitter, there are ways to show the latest tweets in your webpage etc
Re: How to display a webpage from another domain in our php
Posted: Wed Mar 09, 2011 3:23 am
by krieya
For a web application manual tester, there are many routine tasks and have static inputs for that.
Eg: For one of our application to verify the result a manual tester need to navigate through 10 pages filling more than 15 fields on each page which is routine and having static input fields, this task takes more than 45 mins however if we automate this process we can get this done in less than 5 mins.
So I am trying to develop a web page which will perform the tasks like,
Select radio button, set text in text field, click button etc.
So I am doing some R&D to get this job done.
Also I have tried browser addons which is the best solution for this however at workplace we should have admin rights for all the manual tester to get this installed (eg: IMacros addon will get our job done).
Please suggest a way to get this job done.
Thanks!!
Re: How to display a webpage from another domain in our php
Posted: Wed Mar 09, 2011 4:32 am
by VladSun
krieya wrote:So Using this Client URL Library.
Can we click on buttons, set text field values, select radio buttons?
I am looking to assist the tasks of a web application manual tester which always have routine tasks and static inputs.
(like filling data in text fields, selecting radio buttons, dropdowns, clicking links, buttons etc)
Thanks!!
Better use
http://watir.com/
Re: How to display a webpage from another domain in our php
Posted: Wed Mar 09, 2011 5:30 am
by krieya
To use "watir", first I have to install it in my browser which inturn need administrator access at my workplace.
This is the one of the reason why I want to develop a web page that accomodates the user to automate their task with out any installation.
Actually, we have so many addons to do these tasks (imacro, GreaseMonkey etc) however all of these need Installation.
However I am looking for a solution that do not need any installation.
Hence I am doing this R&D to develop a webpage to which user can directly go and write his scripts and execute them with out installing any thing.
I felt that it can be done if we can change the DOM in our browser using javascript or any other stuff however to access the DOM from other domain is causing cross domain issues.
Do I have any way to get this work done?
Thanks!!