Jump to content

Archived

This topic is now archived and is closed to further replies.

aabid

CURL cookie problem

Recommended Posts

Hey guys,

I have developed an script which opens or fetches a page using curl, now the problem is the url i am trying to fetch follows lot of redirects(say 302) and in between it stores several cookies also which i don't know or guess.

So i was just thinking, is there any way so that i can automatically store the cookies in a particular file which server wants to store, and let it sent in request as per the asking of a request  in request header?

 

I hope you would have got what i mean to say here, for example

suppose i want to open http://www.example.com

and now that above url faces lot of redirects probably 5-6 and then ends up on http://www.test.com

 

now in between it stores some cookies in clients computer and then it fetches them also. Since i don't know which cookie it gonna store, I must put this responsibility to PHP itself to store and send the requested cookies in request headers.

 

Also i want to send the referrer also in request header, and it must be the last page that or request sent to the server, no matter whether it's in betwen redirects or to the final page. :)

 

In short i mean to create the complete emulation of browser for this URL.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.