How do I show content in an iframe as a specific user? I want to display an external site (over which I have no control) in an iframe. Someone using my site can have or not have an account on that other site. That site requires membership (which is free) to see any content. In either case, I want to display that other site as a dummy user I made on that site. How do I do this?

I tried using the iframe module and have the iframe point to https://othersite.com/content?email=myemail&amp;password=mypassword, but that seemingly did not do anything. When logged in with my regular user on that other site, the iframe was displayed for my regular user, when not logged in I got a page with a login button.

Can I trigger the pressing of the login button and then fill in the login form, or is it possible that that is not possible?

Edit:
Using curl, I can first log in and then using the same session get the page I want. However, how do I put that out into an iframe? I've now got a variable containing the html of the page I want to show in an iframe between fields belonging to a content type.
The thing to keep in mind here is that an iframe runs on the client side. It is basically a browser within a browser. This also means that it will use an existing session if the client is logged in on the site (you already discovered this):


  When logged in with my regular user on that other site, the iframe was
  displayed for my regular user.


The problem is that Drupal runs server side. Theoretically you should be able to use drupal_http_request() to send the login data to the other site, catch the session cookie and initiate a session. But that would initiate a session on the server, not on the client. The same with cURL, it would log the server in, not the client. So the iframe for the client would still show the login button.

In order to do something client side, your only option is probably to use javascript and perform an POST the login data to the other site. This unfortunately means that the data to login (username and password) also will be sent to the client. A little tech savvy user will be able to compromise your account on the 3rd party site. (If he changes your password, it would break your own site)


  Can I trigger the pressing of the login button and then fill in the
  login form, or is it possible that that is not possible?


Unfortunately also no, browsers implement safety measures to prevent one site form interacting with another. You cannot use javascript (or CSS or anything else) to modify the site within the iframe.

For a second I thought you can try to start the session on the server and then send the session variables to the javascript to process client side. This will not expose your credentials but will still allow someone to take over your session.

So I will conclude with no. There is unfortunately no sensible way of doing this.

Finally there are 2 more things to keep into account; 


Do the terms of use of the other site allow you to share an account with multiple users (you could get into a lot of trouble)
What if the client happens to already have an account on the site? You would override his session and he would be you. I would personally hate your site if it forced me to logout and in again on another website.