curl use browser cookie for chrome extension

时间:2017-08-30 20:45:37

标签: javascript php google-chrome curl cookies

Im trying to do a chrome extension which allows users to share images on a social website. The problem im having is that i dont want to ask for user passwords and making a request from another website creates a No 'Access-Control-Allow-Origin' situation.

So i figure that maybe i could save the document.cookie to the chrome extension and then make a post request from javascript to my own server, from there i will make a curl request using the cookie i saved plus the image information to be shared.

So far, i tried to save the cookie to a .txt file and load it like this:

curl_setopt ($ch, CURLOPT_COOKIEJAR, dirname(FILE).'/'."cookie.txt");

But its not working, its like im not logged in.

How should i make curl use the cookie obtain on the browser?

Thanks

0 个答案:

没有答案