The target of my form submit is an iframe. After, the response is loaded into my iframe, i want to read the cookies especially the jsessionid cookie of external link loaded into my iframe.
Please help me to resolve this issue.
The target of my form submit is an iframe. After, the response is loaded into my iframe, i want to read the cookies especially the jsessionid cookie of external link loaded into my iframe.
Please help me to resolve this issue.
It is impossible because of the "same origin policy". You have to manually send a message (postMessage). See an example here: Accessing cookies of an iFrame in parent window
I think that it can help you
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.google.com");
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; rv:11.0) Gecko/20100101 Firefox/11.0');
curl_setopt($ch, CURLOPT_HEADER ,1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER ,1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION ,1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$content = curl_exec($ch);
// get cookies
$cookies = array();
preg_match_all('/Set-Cookie:(?<cookie>\s{0,}.*)$/im', $content, $cookies);
print_r($cookies['cookie']);