I'm kinda beginning with Jenkins and now i'm facing a problem i need create a job in jenkins sending a request to create a new job i tried to do with CURL but i had no luck and no abilities to make it happen. I still need pass the user and the token once that the server has to log in to do the stuff.
What i have now:
$xml = '<project> ... </project>'; $url = 'http://user:token@localhost:8080/createItem?name=newjobname'; $ch = curl_init(); curl_setopt($ch,CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POSTFIELDS, "xmlRequest=" . $xml); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 300); $result = curl_exec($ch); curl_close($ch); Any ideas ?
No comments:
Post a Comment