【发布时间】:2016-11-04 13:26:40
【问题描述】:
通过以下PHP 脚本触发Jenkins job:
<?php
$testrun_id = "1744";
$cmd = "curl -X POST http://build:f9280f75396f83a0@mobile-jenkins.domain.com:8080/job/android-test/build --data-urlencode json='{\"parameter\": [{\"name\":\"POST_RESULTS\", \"value\":\"true\"}, {\"name\":\"RUN_ID\", \"value\":\"{$testrun_id}\"}, {\"name\":\"CHECK_NAME\", \"value\":\"SampleAutomatedPlan\"}]}'";
exec($cmd,$result);
?>
此脚本在 Mac 上成功运行,并且 jenkins 作业确实被触发。如何使此脚本在 Windows 上运行?在 Windows 上运行 PHP 脚本时出现以下错误?
curl is already installed on windows machine。另外,有没有更好的方法在 PHP 中做 cURL?看看这个:http://php.net/manual/en/book.curl.php,有人可以根据我在上述 PHP 脚本中的 curl 命令(对于 Windows)指出一个示例吗?我的脚本中基于 curl 命令的示例将是理想的。
【问题讨论】:
标签: php windows curl jenkins php-curl