override window.name with php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
harrisonad
Forum Contributor
Posts: 288
Joined: Fri Oct 15, 2004 4:58 am
Location: Philippines
Contact:

override window.name with php

Post 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.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: override window.name with php

Post 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.
User avatar
harrisonad
Forum Contributor
Posts: 288
Joined: Fri Oct 15, 2004 4:58 am
Location: Philippines
Contact:

Passing cookie through HTTP header

Post 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:
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: override window.name with php

Post 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.
User avatar
harrisonad
Forum Contributor
Posts: 288
Joined: Fri Oct 15, 2004 4:58 am
Location: Philippines
Contact:

Re: override window.name with php

Post by harrisonad »

Thank you, master. Harry bless you! :mrgreen:
Post Reply