I wrote a PHP script to run Jenkins build . It was working fine but now I applied some security and created users that can run jenkins builds.
<?php
echo "Run Jenkins\n";
echo shell_exec("curl -X POST http://198.0.0.21:8080/job/test/build");
echo "\n\n";
?>
Now I have a user e.g. test
and with password test
.
How Can I rewrite my PHP
script to use this user as authentication to run builds
I get the following output when I run the above script:
Authentication required
<!--
You are authenticated as: anonymous
Groups that you are in:
Permission you need to have (but didn't): hudson.model.Hudson.Read
... which is implied by: hudson.security.Permission.GenericRead
... which is implied by: hudson.model.Hudson.Administer
-->
I found the solution:
$u="test";
$p="test";
echo shell_exec("curl -X POST http://$u:$p@198.0.0.21:8080/job/test/build");