Page 1 of 1

override window.name with php

Posted: Thu Dec 18, 2008 8:27 pm
by harrisonad
Hi everyone, I have a problem with a project.

I want to read a webpage from an external website (eg. http://somesite.com/targetpage.php)
That was easy using fsockopen() routines

But I run into difficulty reading another page which is being opened in another window by click a "More Info" link.
I looked into it's javascript coding and it's just a simple window.open() call with window name on it.
I tried to copy the url of that page and run it directly on the address bar but it seems like there is some sort of security check that redirects me back to the first page. fsockopen() routine was giving me a "Object Moved" result.

I also tried to disable javascript in my browser but didnt work as well. It's just giving me a "Please enable javascript" result

My first bet is that it checks for cookies written when the first page is loaded.
Secondly, I think it is checking to make sure that second page is being loaded on a popup window. Probably, looking for window.name

My question is
1. Is it possible to specify the window.name using fsockopen() routine or by setting http headers
2. Is there other work arround for this situation. I just need the HTML result of that second page.

Thanks in advance.

Re: override window.name with php

Posted: Thu Dec 18, 2008 9:51 pm
by requinix
You really like underlining stuff, don't you?

To check if it's a cookie (my first guess), open up the first page, clear your cookies, and try opening the second.

Passing cookie through HTTP header

Posted: Thu Dec 18, 2008 11:24 pm
by harrisonad
Thanks for your reply.

I did check the cookies generated, and I attempted to sending dummy cookies via HTTP header (Set-Cookie) similar to those generated ones, but the second page still cannot see those cookies. I still get "It appears that you don't have cookies enabled. Please try opening the menu after enabling cookies." result.

How can I make cookies generated by the first page be available on the second page if I call them separately using fsockopen()?

Btw, underlining words means to emphasize them, right? cheers! :lol:

Re: override window.name with php

Posted: Thu Dec 18, 2008 11:41 pm
by requinix
Yes, underline can mean emphasis, but it starts to lose it's meaning when you keep underlining words ;)

cURL is installed on 99% of hosts out there. Not to mention the code is easier, it can handle all the mucky stuff with HTTP requests that you don't want to touch with a 10-foot pole - including cookies.
An example to get you started.

Re: override window.name with php

Posted: Thu Dec 18, 2008 11:50 pm
by harrisonad
Thank you, master. Harry bless you! :mrgreen: