Jump to content

Cookie based login with php and flash using Curl


vinod_1623

Recommended Posts

hi everyone,

thanks in advance.

 

i have one issue regarding cookie based authentication with curl. i have an application which calls a third party php url for user registration and authentication. when we called athentication with third party url using curl  the result shows succes and cookie is building.  again i need to call another url from same third party server which displays a flash. once the authentication is success the flash automatically logins.  but for me flash ask for username and password, it should n't be like that. i hope my curl call not building cookie in right format. please check my code and give suggestions.

 

<?php
$result=$name=$pass="";

$name= $_SESSION["name"];
$pass=$_SESSION["pass"];


$ch = curl_init();
$cookie_file_path = 'my_cookie.txt';
$cookie_file_path = realpath($cookie_file_path);

curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);

curl_setopt($ch, CURLOPT_VERBOSE, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);

//new ones
curl_setopt($ch, CURLOPT_HEADER, 1);

 

// here i am calling third party url for athentication
curl_setopt($ch, CURLOPT_URL,"http://thirdpartyserver.com/checksession.php?username=".$name."&passme=".$pass);

$result= curl_exec ($ch);

if ($result==true)
{
        //here i am calling the third party flash which is embed in this page. flash should automatically login with cookie.

        header( "refresh:1;url= http://myserver/testfolder/flashLoader.php" );
}
?>

 

please let me my code is correct, and thanks for your suggestions.

 

thanks

vinz

 

 

 

 

Archived

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

×
×
  • Create New...

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.