php - How to store a cookie fetched by CURL such that it can be accessed by a page loaded in an iFrame -
I have a condition by which a page loads, I send some certification data (in this case the Associate array < Code> $ data ) that has been verified by another script on another domain. Code below:
$ cookie_path = 'cookies.txt'; $ Ch = curl_init (); Curl_setopt ($ CH, CURLOPT_URL, 'http://www.mysite.com/verify'); Curl_setopt ($ CH, CURLOPT_POSTFIELDS, $ data); Curl_setopt ($ CH, CURLOPT_RETURNTRANSFER, true); Curl_setopt ($ CH, CURLOPT_FOLLOWLOCATION, true); Curl_setopt ($ CH, CURLOPT_COOKIEJAR, $ cookie_path); Curl_setopt ($ CH, CURLOPT_COOKIEFILE, $ cookie_path); Curl_setopt ($ ch, CURLOPT_COOKIESESSION, true); $ Result = curl_xac ($ CH); The site then sets the session (in this case I am using the codinator framework and it is set as session: $ this-> session-> Set_userdata ('logged_in' is true); ) However, when I load an external site into an iframe, it does not seem that the session is set and the login The page has been redirected.
How can I ensure that my session cookie is being sent properly and can be accessed by iframe?
Your curl script is running server side and stores cookies for another site, but your The browser is loading another site in the client. You can share cookies across domains
If you control the site that you are trying to create a session, then you can pass the session ID in the PHP script, then the iframe URL Can dynamically generate session IDs as query strings. For example, to illustrate:
Editing , if you control the script on another site, you provide the SESSIONID of the certified session You can modify it for your curl script, which can include dynamically generated iframe in the SQL URL after creating your PHP script curl request.
Comments
Post a Comment