Содержимое входа cURL не отображается - PullRequest
0 голосов
/ 28 мая 2020

Теперь я управляю входом в систему с помощью cURL. Это подтверждается следующим:

Cook ie .txt:

# Netscape HTTP Cookie File
# https://curl.haxx.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk.

www.profi-ortung.de    FALSE    /    FALSE    0    PHPSESSID    hg1e550nsu10h4elgbo65hrtsm

Если я захожу в систему вручную, в журнале написано, что логин работает:

  1. Windows Firefox 1.0.7 28-05-2020 09: 56: 33

Почему я не вижу содержимое пользователя, т.е. home. php?

Базовый c код:

<?php

$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_NOBODY, false);
curl_setopt($ch, CURLOPT_URL, "https://www.profi-ortung.de/login.php");
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);

curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt");
//set the cookie the site has for certain features, this is optional
curl_setopt($ch, CURLOPT_COOKIE, "cookiename=0");
curl_setopt($ch, CURLOPT_USERAGENT,
    "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "username=xxx@xxx&password=xxx");
curl_exec($ch);

//page with the content I want to grab
curl_setopt($ch, CURLOPT_URL, "https://www.profi-ortung.de/home.php");
//do stuff with the info with DomDocument() etc
$html = curl_exec($ch);
curl_close($ch);

?>

...