Jump to content
Sign in to follow this  

Cookie based login with php and flash using Curl

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.



$name= $_SESSION["name"];

$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_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20070725 Firefox/");
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.








Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • 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.