Jump to content

Curl - Purchasing items with cookies.


Recommended Posts

Been working awhile on getting this completed with no luck
I have this script that is suppose to purchase items through cookies


   $ch = curl_init(); 
   curl_setopt($ch, CURLOPT_HEADER, true); 
   curl_setopt($ch, CURLOPT_NOBODY, true); 
   curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); 
   curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); 

   curl_setopt($ch, CURLOPT_URL, ""); 
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
   curl_setopt($ch, CURLOPT_POST, true); 
   curl_setopt($ch, CURLOPT_TIMEOUT, 5); 
   curl_setopt($ch, CURLOPT_USERAGENT, "MozillaXYZ/1.0"); 

   $data = array( 
   'creator'   => '1', 
   'storeId'   => '123', 
   'items' => '{id:123,species:stud,at:keepsake}', 
   'pType' => '0' 

   $cookies = array( 
   //Purchase cookie Goes here 
    'anx'           => '', 
    'anxs'           => '', 
    'JSESSIONID'            => '', 
    'dcDirtyCookie'           => '', 
    'user_num'           => '', 
    'user_nme'           => '', 
    'user_info'           => '', 
    'qinfo'           => '' 

   curl_setopt($ch, CURLOPT_COOKIE, $cookies); 

   curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); 
   curl_setopt($ch, CURLOPT_POST, 1); 
   curl_setopt($ch, CURLOPT_POSTFIELDS, $data); 

   $output = curl_exec($ch); 
   $xml = simplexml_load_string($output); 

Instead of it purchasing items with the script provided above and me having my cookies in there it just echo's them back out and onto the page, I would like for it to send the request to the requested url and purchase the item within the $data function.

Link to comment
Share on other sites

I think you need to quote the keys and string values in your json array


$data = array( 
'creator'   => '1', 
'storeId'   => '123', 
'items' => '{id:123,species:stud,at:keepsake}',
   'pType' => '0' 



  'items' => '{"id":123,"species":"stud","at":"keepsake"}', 
Link to comment
Share on other sites


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.