url refactor

This commit is contained in:
fred 2023-03-14 18:07:15 +01:00
parent 5ab3381d5f
commit b8ddf3108b
1 changed files with 11 additions and 15 deletions

View File

@ -30,7 +30,7 @@ class Fred {
preg_match("`url='([^']+)'`isU", $page1, $matches);
$url = $matches[1];
$urlipns = $matches[1];
$page2 = '';
$rounds = 0;
@ -38,7 +38,7 @@ class Fred {
while (empty($page2) and $rounds < 10) {
sleep($this->gatewayDelay);
$page2 = file_get_contents($url);
$page2 = file_get_contents($urlipns);
}
if (empty($page2)) {
@ -62,11 +62,7 @@ class Fred {
$query = 'salt='. $salt .'&pepper='. $pepper . '&messaging=' . $gchangeName;
$url = $this->gatewayProtocol . '://'. $this->gatewayDomain .':' . $this->gatewayPort . '/?' . $query;
// echo '<pre>'; var_dump(htmlspecialchars($url)); echo '</pre>';
$page1 = file_get_contents($url);
$page1 = file_get_contents($this->gatewayProtocol . '://'. $this->gatewayDomain .':' . $this->gatewayPort . '/?' . $query);
if (empty($page1)) {
@ -77,9 +73,9 @@ class Fred {
preg_match("`url='([^']+)'`isU", $page1, $matches);
$url = $matches[1];
$urlmessages = $matches[1];
// echo '<pre>'; var_dump($url); echo '</pre>';
// echo '<pre>'; var_dump($urli); echo '</pre>';
$page2 = '';
$rounds = 0;
@ -87,7 +83,7 @@ class Fred {
while (empty($page2) and $rounds < 10) {
sleep($this->gatewayDelay);
$page2 = file_get_contents($url);
$page2 = file_get_contents($urlmessages);
}
if (empty($page2)) {
@ -111,9 +107,9 @@ class Fred {
$query = 'salt='. urlencode($salt) .'&pepper='. urlencode($pepper) . '&getg1pub=yes';
$url = $this->gatewayProtocol . '://'. $this->gatewayDomain .':' . $this->gatewayPort . '/?' . $query;
$urlj = $this->gatewayProtocol . '://'. $this->gatewayDomain .':' . $this->gatewayPort . '/?' . $query;
// echo '<pre>'; var_dump(htmlspecialchars($url)); echo '</pre>';
// echo '<pre>'; var_dump(htmlspecialchars($urlj)); echo '</pre>';
$opts = array(
'http'=>array(
@ -125,7 +121,7 @@ class Fred {
$context = stream_context_create($opts);
$page1 = file_get_contents($url, false, $context);
$page1 = file_get_contents($urlj, false, $context);
if (empty($page1)) {
@ -142,7 +138,7 @@ class Fred {
// '<pre>' . print_r($matches, true) . '</pre>'
// );
$url = $matches[1];
$urlg1pub = $matches[1];
$page2 = '';
$rounds = 0;
@ -150,7 +146,7 @@ class Fred {
while (empty($page2) and $rounds < 10) {
sleep($this->gatewayDelay);
$page2 = file_get_contents($url);
$page2 = file_get_contents($urlg1pub);
}
if (empty($page2)) {