For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > October 2004 > Copy webpage, protected by session









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Copy webpage, protected by session
Maarten Koster

2004-10-26, 3:55 am

Hi,

I want to copy a page from the internet with fopen and fread. Now the
problem is that you have to be logged in with a sessin to get to that
page. Now I tried a couple of things. I tried to simulate the output of
the login form in a link and open it with fopen and fread, to make the
website see php as a logged in user, and then let the same script php
copy the page I want. This did not work. Than I tried to open the page
with netscape, logged in, and copy all the vars the website had stored
in cookies and make a link out of that and use it in Internet Explorer
to test if it would work. It didn't work. Turning of cookies in IE made
it impossible to log in onto the website.
Is there a way too make this website accept php as a logged in user? I'm
getting out of ideas with my limited knowledge of php and sessions in
general. Maybe I did something wrong in my previous tests.. but any
thoughts?

Thanks in advance, Maarten

R. Rajesh Jeba Anbiah

2004-10-26, 8:55 am

Maarten Koster <maarten@custodis.cistron.nl> wrote in message news:<clkmvc$3gu$2@news.cistron.nl>...
> Hi,
>
> I want to copy a page from the internet with fopen and fread. Now the
> problem is that you have to be logged in with a sessin to get to that
> page. Now I tried a couple of things. I tried to simulate the output of
> the login form in a link and open it with fopen and fread, to make the
> website see php as a logged in user, and then let the same script php
> copy the page I want. This did not work. Than I tried to open the page
> with netscape, logged in, and copy all the vars the website had stored
> in cookies and make a link out of that and use it in Internet Explorer
> to test if it would work. It didn't work. Turning of cookies in IE made
> it impossible to log in onto the website.
> Is there a way too make this website accept php as a logged in user? I'm
> getting out of ideas with my limited knowledge of php and sessions in
> general. Maybe I did something wrong in my previous tests.. but any
> thoughts?


1. http://in.php.net/curl
2. http://curl.haxx.se/libcurl/php/exa...x=cookiejar.php
3. http://curl.haxx.se/libcurl/php/examples/

--
| Just another PHP saint |
Email: rrjanbiah-at-Y!com
Chung Leong

2004-10-28, 3:55 am

"Maarten Koster" <maarten@custodis.cistron.nl> wrote in message
news:clkmvc$3gu$2@news.cistron.nl...
> Hi,
>
> I want to copy a page from the internet with fopen and fread. Now the
> problem is that you have to be logged in with a sessin to get to that
> page. Now I tried a couple of things. I tried to simulate the output of
> the login form in a link and open it with fopen and fread, to make the
> website see php as a logged in user, and then let the same script php
> copy the page I want. This did not work. Than I tried to open the page
> with netscape, logged in, and copy all the vars the website had stored
> in cookies and make a link out of that and use it in Internet Explorer
> to test if it would work. It didn't work. Turning of cookies in IE made
> it impossible to log in onto the website.
> Is there a way too make this website accept php as a logged in user? I'm
> getting out of ideas with my limited knowledge of php and sessions in
> general. Maybe I did something wrong in my previous tests.. but any
> thoughts?
>
> Thanks in advance, Maarten


Use stream_get_meta_data() to get the cookie from the HTTP response, then
use stream_context_create() for adding the cookie into a HTTP request and
for making a POST.


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com