为什么我在这一行Notice: Undefined offset: 1
$lt = $match[1];
$cookiePath = dirname(__FILE__).'/cookies/file.txt';
$url = 'https://signin.infusionsoft.com/login';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiePath);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiePath);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);//$followLocation
curl_setopt($ch, CURLOPT_POST, false);
$response = curl_exec($ch);
curl_close($ch);
preg_match('/<input[^<>]+name="lt"[^<>]+value="([^<>"]+)"/i', $response, $match);
$lt = $match[1];
preg_match('/<input[^<>]+name="execution"[^<>]+value="([^<>"]+)"/i', $response, $match);
$execution = $match[1];
preg_match('/<input[^<>]+name="_eventId"[^<>]+value="([^<>"]+)"/i', $response, $match);
$_eventId = $match[1];
preg_match('/<input[^<>]+name="app_version"[^<>]+value="([^<>"]+)"/i', $response, $match);
$app_version = $match[1];
$post = array(
'lt' => $lt,
'execution' => $execution,
'_eventId' => $_eventId,
'app_version' => $app_version,
'username' => $infusionsoftEmail,
'password' => $infusionsoftPassword,
'_csrf' => 'null'
);