I am trying to login a site with username and password with php curl.
<?php
$url = 'http://XXXXX.com/login';
$ch = curl_init();
$formFields = array('username' => 'XXXX', 'password' => 'WAO', 'button' => 'Login');
$cookiefile = 'C:/wamp/www/tests/cookies.txt';
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_HEADER, TRUE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $formFields);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiefile);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiefile);
echo $response = curl_exec($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
But I am not getting complete html in $response. Mean if in browser i am getting 1000 lines in html. In curl I am getting around 350 lines of html.
It was working before but suddenly stopped working.
Any help?