Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [inne][HTML][PHP]Proszę o pomoc
promtex
post
Post #1





Grupa: Zarejestrowani
Postów: 1
Pomógł: 0
Dołączył: 28.11.2019

Ostrzeżenie: (0%)
-----


Witam Wszystkich!

Jestem tu nowy i trochę zielony zwracam się o pomoc

Założyłem stronę www po przez worldpress , zarejestrowałem płatny dostęp do części witryny po przez getpay.pl, ( opłata jest jedno razowa i dożywotnia ) otrzymałem klucz API, Sekretny klucz API, numer sms premium

na stronie firmy jest ogólny skrypt PHP, który zamieszcze poniżej, nie rozumiem co mam gdzie wpisać, próbowałem wielokrotnie dodawać wartości, szukałem na necie, instalowałem różne wtyczki PHP na worldpressie i nic, czy ktoś mi jest w stanie pomóc? Nie wiem gdzie mam jakie wartości wpisywać i robię to źle bo wklejając w stronę nic mi nie pokazuje albo jakieś liczbolitery, nie wyświetla mi sie żaden panel by wpisać kod sms. Nie czaje tego kompletnie a siedzę parę dni na tym ale pewnie dla niektórych to proste . Proszę pomóżcie ! Oczywiście odwdzięczę się! Dziękuje

<?php

class GetPaySMS
{
//Request
private $apiKey;

private $apiSecret;

private $number;

private $code;

private $unlimited;

private $url;

//Response
private $infoCode = null;

private $info = null;

private $response = FALSE;

private $test = FALSE;

//Info enum
private $infoEnum = array(
100 => 'Empty method',
102 => 'Empty params',
104 => 'Wrong length of client API login data (key/secret)',
105 => 'Wrong client API login data (key/secret)',
106 => 'Wrong client status',
107 => 'No method require params',
200 => 'OK',
400 => 'SMS code not found',
401 => 'SMS code already used',
402 => 'System error'
);



public function __construct($apiKey, $apiSecret)
{
$this->apiKey = $apiKey;
$this->apiSecret = $apiSecret;

//URL GetPaySMS API
$this->url = 'https://getpay.pl/panel/app/common/resource/ApiResource.php';

}



public function getStatus($number, $code, $unlimited = FALSE)
{

$this->number = $number;
$this->code = $code;
$this->unlimited = $unlimited;

$bodyJSON = json_encode(array('apiKey' => $this->apiKey, 'apiSecret' => $this->apiSecret, 'number' => $this->number, 'code' => $this->code, 'unlimited' => $this->unlimited));

$options = array(
'http' => array(
'header' => 'Content-Type: application/json',
'method' => 'POST',
'content' => $bodyJSON
)
);

$context = stream_context_create($options);

$result = json_decode(file_get_contents($this->url, FALSE, $context));

if ($result === FALSE) {
$this->createResponse(402);
return $this;
} else {
if (isset($result->infoCode)) {
if (isset($result->response) && isset($result->test)) {
$this->createResponse($result->infoCode, $result->response, $result->test);
return $this;
} else {
$this->createResponse($result->infoCode);
return $this;
}
} else {
$this->createResponse(402);
return $this;
}
}

}

private function createResponse($infoCode, $response = null, $test = null)
{
if (isset($response) && isset($test)) {
$this->infoCode = $infoCode;
$this->info = $this->infoEnum[$infoCode];
$this->response = $response;
$this->test;
} else {
$this->infoCode = $infoCode;
$this->info = $this->infoEnum[$infoCode];
}
}



//Getters
public function getNumber()
{
return $this->number;
}

public function getCode()
{
return $this->code;
}

public function getUnlimited()
{
return $this->unlimited;
}

public function getInfoCode()
{
return $this->infoCode;
}

public function getInfo()
{
return $this->info;
}

public function getResponse()
{
return $this->response;
}

public function getTest()
{
return $this->test;
}

}
Go to the top of the page
+Quote Post
Tomplus
post
Post #2





Grupa: Zarejestrowani
Postów: 1 885
Pomógł: 231
Dołączył: 20.03.2005
Skąd: Będzin

Ostrzeżenie: (0%)
-----


Dla kodu warto używać tagów [ php ] na naszym forum.
np.
  1. class MojaKlasa {
  2. public $abc = 'cba';
  3. }


Dwa. Sprecyzuj temat.

Trzy. Podałeś klasę od firmy GetPay, a gdzie masz sposób w jaki używasz tą bibliotekę w swoim wordpressie?
Czy w ogóle używasz? może Wordpress ma już jakiś plugin do zainstalowania od GetPay, sprawdzałeś?

Ten post edytował Tomplus 28.11.2019, 18:54:15
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 22.12.2025 - 19:49