Я пытаюсь зайти на https://ssloperator.voiceworks.nl/site/loginform с помощью curl и cookie, однако я не вижу этой страницы или сообщения об ошибке на ней.
Как войти с помощью Curl иSSL и куки тоже не работают.
Можете ли вы помочь мне дальше?Сценарий, который когда-то работал на http, я, возможно, доступен по запросу в PM.
<?php
//=============================================================================
//=== Source code by ############ 2018 ====================================
//=============================================================================
//=============================================================================
//=== Scan voor nieuwe bundels en plaats deze in de database ==============
//=============================================================================
set_time_limit (0);
include ("./functions/www_functions.php");
//include ("./functions/db_functions.php");
if (true)
{
$cookie= Get_Page_Cookie ("https://ssloperator.voiceworks.nl/site/dologin?form[username]=".$usern."&form[password]=".base64_decode ($passw));
$webpage= Get_Page ("https://ssloperator.voiceworks.nl/account/overview?type=wholesale&id=45069");
$pages= stripparts ($webpage, "rel=\"navlink\">", "</a", 0);
$lastpage= "0";
foreach ($pages as $page)
{
if ($page== "volgende")
{ break; }
else
{ $lastpage= $page; }
}
$totaal= 1;
// for ($page= 1; $page<= $lastpage; $page++)
for ($page= 11; $page<= 11; $page++)
{
$tel= 1;
$webpage= Get_Page ("https://ssloperator.voiceworks.nl/account/overview?type=wholesale&id=5321&overviewpage={$page}");
$webpagex= strippart ($webpage, "<tbody>", "</tbody>");
$pages= stripparts ($webpagex, "<a onclick=\"javascript:viewAccount(", ");return false;\" parsetex", 0);
$subStr= array();
foreach ($pages as $nr)
{
if (is_numeric ($nr))
{
$subStr[]= $nr;
}
}
foreach ($subStr as $KlantID)
{
$webpage= Get_Page ("https://ssloperator.voiceworks.nl/mobile/order/overview/accountId/".$KlantID);
$webpagex= strippart ($webpage, "Bedrijfsbundels", "</tbody>");
$pages= stripparts ($webpagex, "<a href=\"", "\">", 0);
if ($pages!= array())
{
$webpage= Get_Page ("https://ssloperator.voiceworks.nl/account/setaccount?accountId=".$KlantID);
$KlantNaam= ucfirst (strtolower (html_entity_decode (strippart ($webpage, "<h3 class=\"company-name\">", " #", 0))));
$KlantEmail= strtolower (html_entity_decode (strippart ($webpage, "id=\"value-adminEmail\"><a href='mailto:", "'>", 0)));
$webpage= Get_Page ("https://ssloperator.voiceworks.nl/mobile/order/overview/accountId/".$KlantID);
// db_write_new_klant ($mysql_conn, $KlantID, $KlantNaam, $KlantEmail);
foreach ($pages as $pag)
{
$webpage= Get_Page ("https://ssloperator.voiceworks.nl". $pag);
$Bundel= intval (strippart ($webpage, "<h1>Orderdetails #", "</h1>", 0));
$webpagex= strippart ($webpage, "overviewContainer_companyBundleUsageOverview", "</table>");
$parts= stripparts ($webpagex, "<td>", "</td>", 0);
$Aansluiting= $parts[0];
$partx= explode (" / ", $parts[1]);
$party= explode (" ", $partx[1]);
$MaxVerbruik= $party [0];
db_write_new_bundel ($mysql_conn, $Bundel, $Aansluiting, $MaxVerbruik, $KlantID);
echo $Bundel." - ".$KlantID." - ".$KlantNaam."<br>\n";
$Volgende= 1;
while ($Volgende== 1)
{
$webpagex= strippart ($webpage, "<span id=\"overviewContainer_companyBundleOverview\">", "</table>");
$webpagey= strippart ($webpagex, "<tbody>", "</tbody>", 0);
$parts= stripparts ($webpagey, "<tr>", "</tr>", 0);
if (count ($parts)> 0)
{
if (strpos ($parts [0], "Geen orders gevonden")=== false)
{
foreach ($parts as $part)
{
$partsx= stripparts ($part, "<td>", "</td>", 0);
// <a href="/mobile/order/detail/id/157503">00157503</a>
// 0633039968
// NuMobile
// <span class="badge badge-info">Data Pack 1000 (Blue) BB (4G)</span>
// 62.23 MB
// 24-11-2016
// <span class="badge badge-success">Actief</span>
$Abonnement= strippart ($partsx[0], "\">", "</");
$GSMnummer= $partsx[1];
$Portfolio= $partsx[2];
$Aansluiting= strippart ($partsx[3], "\">", "</");
$MaxV= explode (" ", $Aansluiting);
$MaxVerbruik= $MaxV[2];
// db_write_new_abonnement ($mysql_conn, $Abonnement, $GSMnummer, $Portfolio, $Aansluiting, $MaxVerbruik, $Bundel, $KlantID);
}
}
}
// <span class="actions pagenav"> </span>
// <a href=" " rel="navlink">volgende</a>
$webpagex= strippart ($webpage, "<span class=\"actions pagenav\">", "</span>");
if ($webpagex!= "")
{
$webpagey= strippart ($webpagex, " <a href=\"", "\" rel=\"navlink\">volgende</a>", 0);
if ($webpagey!= "")
{
$webpage= Get_Page ($webpagey);
$Volgende= 1;
}
else
{ $Volgende= 0; }
}
else
{ $Volgende= 0; }
// While next page, keep repeating
}
}
}
}
}
}
//==================================================================================================================
?>
<?php
//==================================================================================================================
//=== Source code by ############ 2018 ==========================================================================
//==================================================================================================================
$usern= "xxxxx";
$passw= "xxxxx";
//==================================================================================================================
function Get_Page ($url)
{
$stukjes= array();
$url= html_entity_decode ($url);
if (strpos ($url, "?")!== false)
{
$stukken= explode ("?", $url);
$url= $stukken [0];
$parts= explode ("&", $stukken[1]);
foreach ($parts as $part)
{
$s= explode ("=", $part);
$stukjes[$s[0]]= $s[1];
}
}
global $cookie;
$ch= curl_init ();
curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt ($ch, CURLOPT_URL, $url);
if ($stukjes!= array())
{ curl_setopt ($ch, CURLOPT_POSTFIELDS, $stukjes); }
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_COOKIE, $cookie);
$webpage= curl_exec ($ch);
return ($webpage);
}
//==================================================================================================================
function Get_Page_Cookie ($url)
{
$ch= curl_init ();
curl_setopt ($ch, CURLOPT_HEADER, 1);
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$webpage= curl_exec ($ch);
preg_match_all ('|Set-Cookie: (.*);|U', $webpage, $results);
$cookie= implode (';', $results [1]);
return ($cookie);
}
//==================================================================================================================
function Break_Down_URL ($url)
{
// Strip off the HTTP://
$http= "http://";
if (strpos ($url, $http)!== False)
{
if (strpos ($url, $http)== 0)
{ $url= substr ($url, strlen ($http), strlen ($url)- strlen ($http)); }
}
// Strip server from the url
$beginStr= "/";
$beginPos= strpos ($url, $beginStr, 0);
if ($beginPos!== false)
{
$server= substr ($url, 0, $beginPos);
$pageurl= substr ($url, $beginPos, strlen ($url)- $beginPos);
}
// Strip webpage and params from url
$beginStr= "?";
$beginPos= strpos ($pageurl, $beginStr, 0);
if ($beginPos!== false)
{
$page= substr ($pageurl, 0, $beginPos);
$params= substr ($pageurl, $beginPos+ strlen ($beginStr), strlen ($pageurl)- $beginPos- strlen ($beginStr));
}
else
{
$page= trim ($pageurl);
$params= "";
}
// Get params into array
$urlparams= array ();
$beginStr= "&";
$beginPos= strpos ($pageurl, $beginStr, 0);
if ($beginPos!== false)
{
$paramparts= explode ($beginStr, $params);
// $urlparams= array ();
foreach ($paramparts as $param)
{
if (strpos ($pageurl, "=", 0)!== false)
{
$p= explode ("=", $param);
$parameter= $p[0];
$data= $p[1];
}
else
{
$parameter= $param;
$data= "";
}
$urlparams [$parameter]= $data;
}
}
else
{
if (strpos ($pageurl, "=", 0)!== false)
{
$p= explode ("=", $params);
$parameter= $p[0];
$data= $p[1];
$urlparams [$parameter]= $data;
}
}
return (array ($server, $page, $urlparams));
}
//==================================================================================================================
function strippart ($content, $beginStr, $endStr, $start=0)
{
$subStr= "";
$beginPos= strpos ($content, $beginStr, $start);
if ($beginPos!== false)
{
$beginPos= $beginPos+ strlen ($beginStr);
$endPos= strpos ($content, $endStr, $beginPos);
if ($beginPos!== false)
{
$length= $endPos- $beginPos;
$subStr= substr ($content, $beginPos, $length);
}
}
return ($subStr);
}
//==================================================================================================================
function stripparts ($content, $beginStr, $endStr, $start= 0)
{
$subStr= array();
while (strpos ($content, $beginStr, $start)!== false)
{
$beginPos= strpos ($content, $beginStr, $start);
$beginPosA= $beginPos+ strlen ($beginStr);
$endPos= strpos ($content, $endStr, $beginPosA);
if ($endPos!== false)
{
$length= $endPos- $beginPosA;
$a= substr ($content, $beginPosA, $length);
if ($a!= "wijzig")
{ $subStr[]= $a; }
$start= $endPos+ 1;
if ($start> strlen ($content))
{ $start= strlen ($content); }
}
}
return ($subStr);
}
//==================================================================================================================
?>
Приветствие,
Петерс