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")
)
Related
I tried to stream music while connecting the agent into the phone call.
but it's stuck in the stream and then calling.
anyone used it before? I'm sure that's impossible to make this.
Code:
$array[] = array(
"action" => "stream",
"streamUrl" => array("https://pbx.makeapp.co.il/wait.mp3"),
);
$array[] = array(
"action" => "connect",
"eventType" => "synchronous",
"eventUrl" => array("https://pbx.makeapp.co.il/config.json?step=1"),
"timeout" => 30,
"from" => "YOUR_NEXMO_PHONE",
"endpoint" => array(array(
"type" => "sip",
"uri" => "sip:your_sip#sip.antisip.com",
)
)
);
You are correct, it is not possible to have 2 actions running at the same time using an NCCO. When you add a stream action to the start of your NCCO, this must be completed before it moves onto the next action. An NCCO array is actioned from top to bottom, and only moves onto the next action when the current one has finished. You can find out some more info in the concepts of an NCCO section of the documentation: https://developer.nexmo.com/voice/voice-api/ncco-reference
Moodle 3.5.1
plugin auth_saml2sso_moodle35_2018051500.zip
Question:
I guess I have the same error as Naaman Fallouh at https://moodle.org/plugins/auth_saml2sso (comments page 2)
I am able to login with phpBB/SAML and have
http://moodle.localhost/
and
http://moodle.localhost/simplesaml
I am able to login using http://moodle.localhost/simplesaml
I am able to login using http://moodle.localhost/ but after the login I get stuck in a loop:
http://saml_idp.localhost/simplesaml/saml2/idp/SSOService.php?SAMLRequest=chars&RelayState=http%3A%2F%2Fmoodle.localhost%2Flogin%2Findex.php
(saml_idp.localhost is indeed my idp)
Over and over again, with every time other value for chars.
I did set in http://moodle.localhost/simplesaml/config/config.php
'session.phpsession.cookiename' => 'MoodleSession',
That is the only difference from the
phpbb3.localhost/simplesaml/config/config.php.
What else could be wrong? What's your first thought I should look at?
I use the example userpass authentication and defined a user like so:
'admin:admin' => array(
'urn:oid:0.9.2342.19200300.100.1.1' => array('admin'),
'idnumber'=> array('123'),
'email' => array('email#admin.nl'),
'firstname' => array('firstadmin'),
'lastname' => array('lastadmin'),
"phone1" => array('admin'),
"phone2" => array('admin'),
"department" => array('admin'),
"address" => array('admin'),
"city" => array('admin'),
"country" => array('admin'),
"description" => array('admin'),
"idnumber" => array('admin'),
"lang" => array('admin'),
"guid" => array('admin'),
'urn:oid:1.3.6.1.4.1.5923.1.1.1.1' => array('globaladministrators'),
),
In Moodle the plugin configuration I set
Username attribute to: urn:oid:0.9.2342.19200300.100.1.1
Would that not be enough?
Fixed by using sql for session.
Codeigniter: When user logs in I want to save a cookie containing email.
$cookie = array(
'name' => 'email',
'value' => $email,
'expire' => time()+3600*24*30*30,
//'domain' => '.racebooking.net',
'path' => '/',
'secure' => TRUE
);
$this->input->set_cookie($cookie);
Once this code runs, f i look in Firebug i can see the cookie has been properly set. Here is what i see:
name value domain raw size path expires Security
email fontanavideostudios#gmail.com www.test.racebooking.net 36 B / 07/09/2062 20:50:15 Secure
Unfortunately, when i try to retrieve it as follows
$this->input->cookie('email', TRUE);
I get nothing at all. The cookie is there, but i can't get it in CI. Any idea why? The website is installed in www.test.racebooking.net (a subdomain i use for testing before going on production)
Ok, (I think) I found the problem! By setting .racebooking.net as domain, instead of leaving it blank (and, hence, automatically setting as www.test.racebooking.net) i fixed it.
$cookie = array(
'name' => 'email',
'value' => $email,
'expire' => time()+3600*24*30*30,
'domain' => '.racebooking.net',
'path' => '/',
'secure' => TRUE
);
$this->input->set_cookie($cookie);
Now i can retrieve cookie values.
The "why does this happen" question remains still open.
cookie('some_cookie');
The function returns FALSE (boolean) if the item you are attempting to retrieve does not exist.
Source: https://www.codeigniter.com/user_guide/libraries/input.html
There is also:
https://www.codeigniter.com/user_guide/helpers/cookie_helper.html
Here is the form helper I have used for checkbox
<?php
echo $this->Form->input('name',array('type'=>'checkbox','options'=>$options));
?>
and $options array is as follows:
[options] => Array
(
[58] => 58
[85] => 85
)
But I am getting only one check box with both values in it. How can I get check box for each values.
Use the multiple attribute.
echo $this->Form->input('Name',array(
'label' => __('Label',true),
'type' => 'select',
'multiple' => 'checkbox',
'options' => $options,
));
Another thing you have to check, and this is truly a general rule in cakephp when things do not run as expected. is:
"Are you properly closing the form? Do your inputs stay inside <form>...</form>? If you are not sure how to check simply use your preferred
DevTool and check the rendered HTML page.
This is almost the thing I forgot to check mostly and which always let me waste a lot of time!
If your are creating the $option variable in the view this will help you :
$options = array("key" => "value" , "key" => "value" , "key" => "value");
But if you are setting it the controller this will help you :
$this->set('options', array("key" => "value" , "key" => "value" , "key" => "value"));
key is the value in each option of the select input
value is the text of the option tags
Can anyone explain how to use the AWS PHP SDK to log the metric in the style like the above screen.
I use the following PHP code but the select menu is showing "ELB: AvaliabiltyZone", how to make it show "Aggregated by AvaliabiltyZone"? What is the logic used here?
$response = $cw->put_metric_data("ELB", array(
array(
"MetricName" => "Latency",
"Dimensions" => array(
array("Name" => "AvaliabiltyZone" , "Value" => "us-east-1c")
),
"Timestamp" => "now",
"Value" => 1,
"Unit" => "None"
),
));
AvaliabiltyZone
You misspelled "AvailabilityZone"
This maybe won't answer the question, but it might fix some things...
$cw = new AmazonCloudWatch();
$cw->set_region('monitoring.'.$region.'amazonaws.com');
$res1 = $CW->put_metric_data('Sys/RDS' ,
array(array('MetricName' => 'Uptime' ,
'Dimensions' => array(array('Name' => 'AvaliabiltyZone',
'Value' => 'us-east-1c')),
'Value' => $Uptime,
'Unit' => 'Seconds')));
Click Here