i have a php page that logs in an account as if the real person is doing it. i would like to put in a php script that checks the webpage URL currently opened. the page works this way:
i run localhost/loginmirror/index.php from my browser.
new browser window is automatically opened. page loaded is the URL of the page i placed on my code (ex: https://twitter.com/).
i use php scripts to put in the username and password and click the Login button. everything necessary for input and clicking is done by
my php code. no human needed. after clicked, i am redirected to the
next page and so on and so on.
i would like to get the URL of the particular page now opened. i have tried using
$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']
but it retrieves this: loginmirror/index.php instead of returning which page in google mail is now opened.
how do i get the URL that i want to retrieve? thanks
Related
I have made a product landing page (in html ) and a register web page (in php)
I want the user to click on register icon on the html page such that the user should go on to the register page (made in php), to enter it's credentials.
what should i do to solve this problem
welcome!
Let's say the register page is named register.php.
Then simply create a link around the register icon on your landing page, or use text, and link to the register.php file.
E. g.:
🔑 Register
Or if it's on another server, use the full URL (the address the register form in PHP is reachable from your browser):
🔑 Register
Navigating from a .html to a .php-file and vice versa can simply be done using normal HTML links (<a> tag).
I have a script which used to download files from my website, On downloading page of browser, it shows the url of sender. Like
If file is downloading from http://localhost/w/download.zip it shows the same url, But what I want to give is some fake domain or url, like http://www.example.com/download.zip.
Means I want to change the url or domain that the browser is reporting the download is from.
I know it can be done by this also
Download!
But it does not change the domain. And shows me another link from that my domain.
Question is : How do I do that?
If you want to show a different URL to the user when he hovers the mouse over, you could use JavaScript for it, Google itself does something similar. Here's a simple example:
Google?
The browser will show google.com when hovering over the link, but when clicked, JavaScript redirects to facebook.com and cancels the default behaviour.
Note that this won't work if JavaScript is disabled in the user's browser (very few cases nonetheless).
Demo: http://output.jsbin.com/pehehorune
I have a website that consists of entirely php pages. If you do the following:
Google -> php page1 -> php page2 -> hit the browser back button and you go back to Google
I want the user to get taken back to php page1 instead of Google when they hit the back button on php page2.
I have a feeling this is to do with the automatic scripts, generated by php, that stop the browser caching pages. However, I don't want the pages to be cached as this would stop the content being updated.
Thanks for any advice!
function goToTag(tagid, tagloc){
location.replace("main.php?tagid="+tagid+"&result="+tagloc);
}
Switch it to location.href="main.php?tagid="+tagid+"&result="+tagloc; and you'll be just fine. location.replace does what it says on the tin - it replaces the current history item with the new page.
I am trying to grab a file .pdf from a server. There is a hyperlink at the page, by clicking that link it goes to a page, it checks for some privileges, then it redirects to another page which shows the content of the .pdf within an Iframe.
lets say beginning url is http://site.com/docs/1.pdf
on click it goes to another page, then another one and it comes whth the last page
http://site.com/viewer/pdfs/1.pdf
the last page shows the pdf content within an Iframe.
I realized that the software IDM (Internet download manager) can follow the redirections and download the file by clicking the first link.
I was wondering if there is an algorithm or library or class or hint that I can figure out how to do that in PHP scripting.
by the way, once I wrote a code to read the header of the page and I could redirect to the second page, but I want to know if there is a general algorithm for this or not.
If you are doing the HTTP stuff manually, check for 30x statuscodes and the Location header.
However, you could simply use CURL and set CURLOPT_FOLLOWLOCATION.
Yes, just like ThiefMaster said, you could look for the Location header.
Have a look here, maybe this can be a help to you:
http://codesnippets.joyent.com/posts/show/1214 This function retrieves file size of a remote file, why don't you try to change it slightly so that it gets the final URL?
I have built an in browser engine that will retrieve pages without executing server side scripting... seems ridiculous, I know, but I'm doing this as part of a school project.
The problem that I am having is that once it displays the page if a link is clicked it will bring you to www.their-site.com instead of www.my-site.com?site=www.their-site.com.
Basically I need my php page to detect if a link is clicked and, if so, add "www.my-site.com?" before it so that all sites will still be rendered without all the server side scripting. Is their any way to do this?
---------------EDIT---------------------------------------------------------------------------
Ok I guess I wasn't clear enough the first time sorry about that.
I have made a php page that will display the contents of any site without executing the server side scripting that belongs with that page. This allows you to get around those annoying news articles that allow you to have a glimpse at them for two seconds and then a login box appears. the problem is once you've accessed the pages if you click any links you are connected to their server and the scripts turn back on. I want MY php to execute, not THEIRS
You need to know what you want first.
You say no server side scripting, then you mention php.
To do this, I don't think you can do it with just js.
You need to get the pages, using php, depending on what exactly, modify them such that when a link is clicked, it sends an ajax call to another page. This will require either regex replacement or the use of htmldom.
When a link is clicked, it should send the ajax response to the php page which can then request tha page, make modifications and send it back to the browser. You can then use js to replace the page contents.