Преобразовать строку в 8-битный двоичный файл в переполнении стека

Мне нужно иметь возможность преобразовать строку в 8-битный двоичный файл с использованием PHP. Это возможно? Строка будет URL-адресом изображения, например, https://www.someurl.com/someimage.jpg

Я делаю эту функцию: https://www.id3globalsupport.com/Website/content/Sample%20Code/Web%20Dev%20Guide%20HTML/html/6dfaafdb-ade8-1020-d02d-d43822eb4ae7.htm

Мне только что сказал GBG, что URL-адрес изображения, который я посылаю, должен быть 8-битным двоичным массивом.

Это код, он отлично работает, просто нужно, чтобы переменная $ bit8 была двоичным массивом:

date_default_timezone_set('Europe/London');
class WsseAuthHeader extends SoapHeader
{
private $wss_ns = 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd';
function __construct($user, $pass, $ns = null)
{ if ($ns)
{
$this->wss_ns = $ns;
}
$auth = new stdClass();
$auth->Username = new SoapVar($user, XSD_STRING, NULL, $this->wss_ns, NULL, $this->wss_ns);
$auth->Password = new SoapVar($pass, XSD_STRING, NULL, $this->wss_ns, NULL, $this->wss_ns);
$username_token = new stdClass();
$username_token->UsernameToken = new SoapVar($auth, SOAP_ENC_OBJECT, NULL, $this->wss_ns, 'UsernameToken', $this->wss_ns);
$security_sv = new SoapVar(
new SoapVar($username_token, SOAP_ENC_OBJECT, NULL, $this->wss_ns, 'UsernameToken', $this->wss_ns),
SOAP_ENC_OBJECT, NULL, $this->wss_ns, 'Security', $this->wss_ns);
parent::__construct($this->wss_ns, 'Security', $security_sv, true);
}
}
$username = "XXXXXX";
$password = "XXXXXX";
$wsse_header = new WsseAuthHeader($username, $password);
$options = array(
'soap_version' => SOAP_1_1,
'exceptions' => true,
'trace' => 1,
'wdsl_local_copy' => true
);
// This is currently linked to the pilot or test site.
$wsdl = 'https://pilot.id3global.com/ID3gWS/ID3global.svc?wsdl';
$soapClient = new SoapClient($wsdl, $options);
$soapClient->__setSoapHeaders(array($wsse_header));
$objParam = new stdClass();
$objParam ->ProfileIDVersion = new stdClass();
$objParam ->ProfileIDVersion ->ID ='XXXXXXXXXXXXXX'; // This can be found via the admin portal of id3 global.
$objParam ->ProfileIDVersion ->Version =0; // Setting this to zero will by default call the latest active version of the profile$objParam ->CustomerReference particular customer
$objParam ->InputData = new stdClass();
$objParam ->InputData->UploadAndProcess = new stdClass();
$objParam ->InputData->UploadAndProcess->DocImage = new stdClass();
$objParam ->InputData->UploadAndProcess->DocImage->$bit8;
if (is_soap_fault($soapClient)) {
throw new Exception(" {$soapClient->faultcode}: {$soapClient->faultstring} ");
}
$objRet = null;
try
{
$objRet = $soapClient->AuthenticateSP($objParam);
echo '<pre>';
print"Decision Band :".($objRet->AuthenticateSPResult->BandText)."<br>";
echo '</pre>';}
catch (Exception $e) {
echo "<pre>";
print_r($e);
echo "</pre>";
}
if (is_soap_fault($objRet))
{
throw new Expception(" {$objRet->faultcode}: {$objRet->faultstring} ");
}

0

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector