Hi i have a problem with code below.
I log in to the website using curl. Then I go to the sub and send a POST request to get the results in JSON format. Unfortunately, as a result I get: NULL
// options
$EMAIL = '...';
$PASSWORD = '...';
$cookie_file_path = "cookies/cookies.txt";
$LOGINURL = "https://www.domainname.com/auth/login";
$agent = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.76 Safari/537.36";
$ch = curl_init();
$headers[] = "Accept: */*";
$headers[] = "Connection: Keep-Alive";
$headers[] = "Content-Type: application/json";
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
$fields = array();
$fields['username'] = $EMAIL;
$fields['password'] = $PASSWORD;
$POSTFIELDS = http_build_query($fields);
curl_setopt($ch, CURLOPT_URL, $LOGINURL);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $POSTFIELDS);
$result = curl_exec($ch);
$params = array(
'akcja' =>'test1',
'Bank' =>'null',
'Produkt' =>'test2',
'ProwKOd' =>'undefined',
'domainKey'=>'326',
);
$remotePageUrl = 'http://www.domainname.com/users/Links';
curl_setopt($ch,CURLOPT_POST,count($params));
curl_setopt($ch,CURLOPT_POSTFIELDS, http_build_query($params));
curl_setopt($ch, CURLOPT_URL, $remotePageUrl);
$result = curl_exec($ch);
curl_close($ch);
print var_dump(json_decode($result,true));
I tried to send data in json format, but it unfortunately doesn't help.
EDIT
Piece of data that should display the script.
{"tabela":"\r\n\t\t\t\t<div class='provisionBox'>\r\n\t\t\t\t <img src = '\/img\/promotedIcon.png' class='promotionSign' \/>\r\n\t\t\t\t <div class='provisionBoxLeft'>\r\n\t\t\t\t \t<div class='provBoxRodzajIcon'> <img class='' src='\/_img\/product_icon\/konto_osobiste.png' alt='Konto osobiste' \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttitle='Konto osobiste'><\/div>\r\n\t\t\t\t\t\t<div class='provBoxProductKind'>Rachunek osobisty \"Konto osobiste PLN\"<\/div>\r\n\t\t\t\t\t\t<div class='clear'><\/div>\r\n\t\t\t\t \t<div class='provBoxBankLogo'>