Problem with authentication on basic search engine (PHP sending cookies)

I play a game sort of like a space version of neopets. However, the search function to find items in the market is horrible, and I’d like to be using an improved one. I have one partially written, but the problem is that the stores cannot be viewed by anyone unless they are logged in. I am having PHP scan the source of the page to figure out whether the item is there or not. How can I use PHP to send a cookie along with the request for the page? Thanks!

In PHP you can set cookies in two ways. First, using function setcookie(), and alternative using function header().

I am not setting it on the client’s computer. The PHP script is reading the source of a page that it views. The server is viewing a page that requires authentication, but I can’t figure out how to authenticate the server. I am trying to use PHP to send a cookie along with the request to view the page.

So you’re trying to emulate browser’s behaviour in your php script? You can implement this by sending raw cookies via header(). Or use class like Snoopy (find it on sourceforge), it is good for such tasks.

Thanks, snoopy looks perfect.

Sponsor our Newsletter | Privacy Policy | Terms of Service