在curl url中传递日期



我正试图从一些特定的日期范围中获取数据,

<?php
function index_finder()
{
$strStart = '2021-01-02';
$strEnd   = '2021-08-28'; 

$dteStart = new DateTime($strStart);
$dteEnd   = new DateTime($strEnd);
$dteDiff  = $dteStart->diff($dteEnd);
$date = $dteDiff->format("%m monthn");
if ($date > 6)
{
$curl = 'https://localhost:9200/studio-.'$strStart'.,studio-.'$strEnd'./_search?pretty';
print $curl;
}

}

如果日期范围超过6个月,则需要将此curl称为开始日期和结束日期,我正在尝试在url中插入开始日期和结束日期。

请帮我把网址中的日期传出去。

提前感谢

替换此:

$curl = 'https://localhost:9200/studio-.'$strStart'.,studio-.'$strEnd'./_search?pretty';

通过这个:

$curl = 'https://localhost:9200/studio-' . $strStart . ',studio-' . $strEnd . '/_search?pretty';

最新更新