I am using PowerShell to run a php script on a daily basis. I can't seem to get the json
return back from Invoke-RestMethod
. How can that be accomplished?
Here is the code I am using:
$limit = 200;
for ($i=1; $i -le $limit; $i++)
{
Write-Host $i started of $limit
$Site = "http://example.com/updates"
$Info = Measure-Command{
$data = @{call_type = 'powershell'}
$resp = (Invoke-RestMethod -Method Post -URI $Site -Body $data -TimeoutSec 500).results
}
Write-Host resp - On $resp.date, $resp.num were downloaded
Write-Host $i took $Info.TotalSeconds s
Write-Host ---------------------------------------
}
The PHP script is passing back a json string like:
{date: '2014-09-30', num: 127569}