未定义的偏移量:1卷曲错误infusionsoft错误

时间:2018-04-09 03:50:52

标签: php curl infusionsoft

为什么我在这一行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'
);

0 个答案:

没有答案