Set cookies in configuration using PHP


I'd like to print a document with PDFreactor using PHP.

Unfortunately, the document generation fails when specifying cookies in the configuration. Leaving out the cookies line prints our login page - with is correct as the page displays a login screen if no session cookie could be identified.

$config = array( "document"=> "http://localhost", "logLevel"=> LogLevel::DEBUG, "javaScriptMode" => JavaScriptMode::ENABLED_TIME_LAPSE, "enableDebugMode" => true, "cookies" => array("sid" => "abcdefghijklmno")//<-- problematic line );

Could anybody verify that cookie passing fails with PHP or give advice about the correct syntax?


The issue is caused by a mistake in the syntax of your cookie configuration. The correct syntax would be:

$config = array( "document"=> "http://localhost", "logLevel"=> LogLevel::DEBUG, "javaScriptMode" => JavaScriptMode::ENABLED_TIME_LAPSE, "enableDebugMode" => true, "cookies" => array( array("key" => "sid", "value" => "abcdefghijklmno") // <-- corrected ) );

For multiple cookies:

"cookies" => array( array("key" => "cookiename1", "value" => "cookievalue1"), array("key" => "cookiename2", "value" => "cookievalue2") )


  • Making post request using urllib
  • Wrong offset for TimeZone casablanca (java)
  • RecyclerView lagging inside ScrollView
  • show Custom Message at Table area in jqGrid
  • How do I specify the positive class in an H2O random forest or other binary classifier?
  • Jquery Tabs - Flash of Unstyled Contnet (FOUC)
  • Spring boot application not using jemalloc
  • Xamarin.iOS Status Bar Disappears When Changing Its Text Color
  • Filter by multiple patterns with filter() and str_detect()
  • Google tts api giving me blank mp3
  • Error when build LineageOS: “make: *** [ninja_wrapper] Error 1”
  • MySQL equivalent to MS SQL's Cross Apply
  • CameraPreviewImageSource empty preview frame
  • Selenium - how to switch to a different (login) window that is brought up?
  • Linux could not find metis.h
  • Display standard razor/mvc 3 validation messages displayed in another language
  • Connect from a client to a sails based server
  • ClearCase can I use clearexport_ccase/clearimport to copy VOB data to a VOB on a different machine
  • Create a Terminal-Based Bluetooth Monitor in XCode?
  • How can I access the Google account user_id?
  • Insert statement not working using execute(array()) of PDO Extension
  • Getting/building the SQL (with parameters) from NHibernate 3.2
  • Querying Elasticsearch Address Based Index
  • Reader monad - how does it conform to Monad interface?
  • Node.js custom error handling
  • Set initial vuetify v-select value
  • Separating definition/instantiation of template classes without 'extern'
  • openpyxl - adding new rows in excel file with merged cell existing
  • Problems using phonegap / cordova file plugin part 2 - synchronicity
  • Ruby regex for matching simpliest Ruby's regexes
  • How to split wav file into two or more parts using c#
  • Content-Type alternative in MQTT
  • How to include associated objects using gon in Rails/jQuery
  • Unity3d lost directional light shadows after generate assetBundle (.unity3d file)
  • How to encrypt Connectionstring written in web.config from codebehind?
  • Call Microservice from another Microservice within Docker
  • Jersey serializes character value to ASCII equivalent numeric string
  • Running R's aov() mixed effects model from Python using rpy2