can someone assist with experiance of the domainbox api and php please - php

Has anyone had experience with the domainbox.com api? I have never done anything like this before and any help would be really appreciated. What i'm trying to do is using php send the request and bring back the results displaying them on the page but to be honest i don't even know where to start or if this is even the best way to do it.
html
<form action="searchdomain.php" method="post">
domain: <input type="text" name="domainname">
<input type="submit">
</form>
php
<?php
$client = new SoapClient('https://live.domainbox.net/?WSDL', array('soap_version' => SOAP_1_2));
// populate the inputs....
$params = array(
'AuthenticationParameters' => array(
'Reseller' => 'pulseinternet',
'Username' => 'roy_admin',
'Password' => '*********'
),
'CommandParameters' => array(
'DomainName' => '($_POST["domainname"])',
'LaunchPhase' => 'GA'
)
);
$result = $client->CheckDomainAvailability($params, AvailabilityStatus);
print_r($result);
?>
results
stdClass Object ( [CheckDomainAvailabilityResult] => stdClass Object ( [ResultCode] => 250 [ResultMsg] => TLD '' not supported [TxID] => d015865c-b99e-400f-94b9-badf89b0216f [AvailabilityStatus] => 3 [AvailabilityStatusDescr] => ErrorOccurred [LaunchPhase] => GA [DropDate] => [BackOrderAvailable] => [AdditionalResults] => stdClass Object ( ) ) )
Thanks in advance Roy

Here you are a working example:
$dom = 'test12309go.com';
$tld = '.com,.net,.org';
//$client = new SoapClient('https://sandbox.domainbox.net/?WSDL', array('trace' => true, 'soap_version' => SOAP_1_2));
$client = new SoapClient('https://live.domainbox.net/?WSDL', array('trace' => true, 'soap_version' => SOAP_1_2));
$params = array(
'AuthenticationParameters' => array(
'Reseller' => 'MyReseller',
'Username' => 'MyUsername',
'Password' => 'MyPassword'
),
'CommandParameters' => array(
'DomainName' => $dom,
'TLDs' => $tld,
'Limit' => '10',
'CheckAtRegistry' => true,
'DomainCheck' => array(
'Include' => true
),
'NameSuggestions' => array(
'Include' => false
),
'PremiumDomains' => array(
'Include' => false
),
)
);
$result = $client->CheckDomainAvailabilityPlus($params);
//echo $client->__getLastRequest();
print_r($result);

Related

onwsignal web notification error

actually i am tring to get data from url which i already got but i can't able to insert data into the array please check values are dummy1 dummy2
Array ( [id] => 491 [headings] => ‘సౌందర్య లహరి’ ఎలా ఉంది అంటే..? [content] => శ్రీ వాసు దర్శకత్వం లో బెల... [userPic] => 682473.jpg ) JSON sent: {"app_id":"35fi6c27-5f39-4s9f-94db-79bf123g0f9","included_segments":["All"],"data":{"foo":"bar"},"contents":{"en":"dummy1"},"headings":{"en":"dummy2"},"url":"http:\/\/www.gggg.in\/view.php?id=[id]","chrome_web_image":"http:\/\/www.ggg.in\/admin\/user_images\/[userPic]"} JSON received: {"allresponses":"{\"id\":\"f66a03a4-1b17-8tf3-93ed-f3ad6rt7cdb9\",\"recipients\":6}"}
the above data got from url
http://www.ggg.in/gistfile1.php?id=491&headings=%E2%80%98%E0%B0%B8%E0%B1%8C%E0%B0%82%E0%B0%A6%E0%B0%B0%E0%B1%8D%E0%B0%AF%20%E0%B0%B2%E0%B0%B9%E0%B0%B0%E0%B0%BF%E2%80%99%20%E0%B0%8E%E0%B0%B2%E0%B0%BE%20%E0%B0%89%E0%B0%82%E0%B0%A6%E0%B0%BF%20%E0%B0%85%E0%B0%82%E0%B0%9F%E0%B1%87..?&content=%20%E0%B0%B6%E0%B1%8D%E0%B0%B0%E0%B1%80%20%E0%B0%B5%E0%B0%BE%E0%B0%B8%E0%B1%81%20%E0%B0%A6%E0%B0%B0%E0%B1%8D%E0%B0%B6%E0%B0%95%E0%B0%A4%E0%B1%8D%E0%B0%B5%E0%B0%82%20%E0%B0%B2%E0%B1%8B%20%E0%B0%AC%E0%B1%86%E0%B0%B2...&userPic=682473.jpg
and i need to insert the values in this function
function sendMessage() {
$content = array(
"en" => 'dummy1'
);
$headings = array(
"en" => 'dummy2'
);
$hashes_array = array();
$fields = array(
'app_id' => "35fi6c27-5f39-4s9f-94db-79bf123g0f9",
'included_segments' => array(
'All'
),
'data' => array(
"foo" => "bar"
),
'contents' => $content,
'headings' => $headings,
'url' => 'http://www.gggg.in/view.php?id=[id]',
'chrome_web_image' => 'http://www.ggg.in/admin/user_images/[userPic]',
);
OneSignal does not support substituting variable data directly into API calls. However, you can achieve this with Tag and Variable Substitution: https://documentation.onesignal.com/docs/personalization
this is the solutions for this Question i asked about
actually i have a varable passing throug url and i need them to insert into function
$array = [
'id' => 498,
'value2' => 'యూట్యూబ్‌లో “భరత్ అనే నేను” అన్ కట్ సీన్లు..!',
'value1' => 'కొరటాల శివ దర్శకత్వం లో సూ...',
'value3' => '525722.jpg'
];
sendMessage($array);
function sendMessage($array) {
$content = array(
"en" => $array['value1']
);
$headings = array(
"en" => $array['value2']
);
$hashes_array = array();
$fields = array(
'app_id' => "31pe2347-5i39-4y9f-2222-79b5875f00f9",
'included_segments' => array(
'All'
),
'data' => array(
"foo" => "bar"
),
'contents' => $content,
'headings' => $headings,
'url' => 'http://w...content-available-to-author-only...9.in/view.php?id=' . $array['id'],
'chrome_web_image' => 'http://w...content-available-to-author-only...9.in/admin/user_images/' . $array['value3'],
);
print_r($fields);
}

NuSOAP returns empty array

I have the problem, that the NuSOAP server returns an empty array. I read and tried a lot of topics/things already but the result is always the same. I guess its only a minor thing you guys can solve within a minute.
I want to put an array of strings containing client information into another array that holds all servers:
Array
(
[Client1] => Array ([HostName] => 'TestHostName', [IP] => '1.1.1.1'),
[Client2] => Array ([HostName] => 'TestHostName', [IP] => '2.2.2.2'),
[Client3] => Array ([HostName] => 'TestHostName', [IP] => '3.3.3.3')
)
The arrays will get filled from mysql data, but for testing purposes I created a static array with data. Here is what I have got so far:
<?php
require_once ('lib/nusoap.php');
require('mysql.php');
$ServerName = 'server';
$ServiceName = 'CentralConfigService';
$ServiceURL = 'http://' . $ServerName . '/' . $ServiceName;
$Server = new soap_server();
$Server -> configureWSDL($ServiceName, $ServerName . '/' . $ServiceName);
function GetClientInfo($ClientName)
{
$Clients = array();
$ClientInfo = array(
'HostName' => 'testiname',
'IP' => 'testip',
'Type' => 'testtype',
'Config' => 'testconfig',
'Routines' => 'testroutines',
'Files' => 'testfiles',
'Access' => 'testaccess');
$Clients[$ClientName] = $ClientInfo;
return $Clients;
}
$Server -> wsdl -> addComplexType(
'ClientInfo',
'complexType',
'struct',
'sequence',
'',
array(
'HostName' => array('name' => 'HostName', 'type' => 'xsd:string'),
'IP' => array('name' => 'IP', 'type' => 'xsd:string'),
'Type' => array('name' => 'Type', 'type' => 'xsd:string'),
'Config' => array('name' => 'Config', 'type' => 'xsd:string'),
'Routines' => array('name' => 'Routines', 'type' => 'xsd:string'),
'Files' => array('name' => 'Files', 'type' => 'xsd:string'),
'Access' => array('name' => 'Access', 'type' => 'xsd:string')
)
);
$Server -> wsdl -> addComplexType(
'Clients',
'complexType',
'array',
'',
'SOAP-ENC:Array',
array(),
array(
array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:ClientInfo')
),
'tns:Clients'
);
$Server -> register(
'GetClientInfo',
array('HostName' => 'xsd:string'),
array('return' => 'tns:Clients'),
$ServiceURL,
$ServiceURL . '#GetClientInfo',
'rpc',
'encoded',
'Get config by type');
if ( !isset( $HTTP_RAW_POST_DATA ) ) $HTTP_RAW_POST_DATA = file_get_contents( 'php://input' );
#$Server -> service($HTTP_RAW_POST_DATA);
?>
when I call the function "GetClientInfo", I always get an empty array:
Array
(
[0] => Array
(
[0] => Array
(
)
[1] => Array
(
)
[2] => Array
(
)
[3] => Array
(
)
[4] => Array
(
)
[5] => Array
(
)
[6] => Array
(
)
)
)
The client calls the function:
<?php
require_once('lib/nusoap.php');
$wsdl = "http://server/server.php?wsdl";
$client = new nusoap_client($wsdl, 'wsdl');
$result = $client -> call('GetClientInfo', array('ClientName'=>'Client1'));
print_r($result);
?>
Sorry for the long post. I hope it contains all necessary information.
Thanks a lot in advance!
Cheers,
Daniel
I found my mistake. The complexType that includes the struct has to look like that:
$Server -> wsdl -> addComplexType(
'Clients',
'complexType',
'array',
'',
'SOAP-ENC:Array',
array(),
array(
array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:ClientInfo')
),
'tns:ClientInfo'
So 'tns:ClientInfo' instead of 'tns:Clients' in the last line.
Here is a fully functioning example:
server.php
<?php
// Includes
require_once ('lib/nusoap.php');
require('mysql.php');
require('cc_functions.php');
// General SOAP configuration
$ServerName = 'server';
$ServiceName = 'CentralConfigService';
$ServiceURL = 'http://' . $ServerName . '/' . $ServiceName;
$Server = new soap_server();
$Server -> configureWSDL($ServiceName, $ServerName . '/' . $ServiceName);
function GetClientInfo($ClientName)
{
$Clients = array();
$Clients1 = array(
'HostName' => 'testiname',
'IP' => 'testip',
'Type' => 'testtype',
'Config' => 'testconfig',
'Routines' => 'testroutines',
'Files' => 'testfiles',
'Access' => 'testaccess');
$Clients2 = array(
'HostName' => 'testiname2',
'IP' => 'testip2',
'Type' => 'testtype2',
'Config' => 'testconfig2',
'Routines' => 'testroutines2',
'Files' => 'testfiles2',
'Access' => 'testaccess2');
array_push($Clients, $Clients1);
array_push($Clients, $Clients2);
return $Clients;
}
$Server -> wsdl -> addComplexType(
'ClientInfo',
'complexType',
'struct',
'all',
'',
array(
'ID' => array('name' => 'ID', 'type' => 'xsd:integer'),
'HostName' => array('name' => 'HostName', 'type' => 'xsd:string'),
'IP' => array('name' => 'IP', 'type' => 'xsd:string'),
'Type' => array('name' => 'Type', 'type' => 'xsd:string'),
'Config' => array('name' => 'Config', 'type' => 'xsd:string'),
'Routines' => array('name' => 'Routines', 'type' => 'xsd:string'),
'Files' => array('name' => 'Files', 'type' => 'xsd:string'),
'Access' => array('name' => 'Access', 'type' => 'xsd:string')
)
);
$Server -> wsdl -> addComplexType(
'Clients',
'complexType',
'array',
'',
'SOAP-ENC:Array',
array(),
array(
array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:ClientInfo[]')
),
'tns:ClientInfo'
);
$Server -> register(
'GetClientInfo',
array('ClientName' => 'xsd:string'),
array('return' => 'tns:Clients'),
$ServiceURL,
$ServiceURL . '#GetClientInfo',
'',
'rpc',
'Get config by type');
if (!isset($HTTP_RAW_POST_DATA)) $HTTP_RAW_POST_DATA = file_get_contents('php://input');
#$Server -> service($HTTP_RAW_POST_DATA);
?>
client.php
<?php
require_once('lib/nusoap.php');
$wsdl = "http://server/server.php?wsdl";
$client = new nusoap_client($wsdl, 'wsdl');
$result = $client -> call('GetClientInfo', array('ClientName'=>''));
print_r($result);
?>

AWS SDK for PHP DynamoDB PutItem for non null variables only

I'm inserting variables into the AWS DynamoDB from an array
$dbf[$a]['variable1'], $dbf[$a]['variable2'], $dbf[$a]['variable3'] ...
for some $a, only 'variable1' and 'variable2' are set, and
for other $a, all 'variable#' are set.
The below code won't work because Null or non set variables aren't
allowed.
Is there a way in the loop to only attempt to "PutItem" for variables that are set?
foreach($dbf as $day)
{
$result = $client->PutItem(array(
'TableName' => 'AWIS',
'Item' => array(
'id' => array('S' => $day['id']),
'date'=> array('S' => $day['date']),
'max'=> array('N' => $day['max']),
'min'=> array('N' => $day['min']),
'pre'=> array('N' => $day['pre']),
'max_soil_temp'=> array('N' => $day['max_soil_temp']),
'min_soil_temp'=> array('N' => $day['min_soil_temp']),
'evap'=> array('N' => $day['evap']),
'veg_wetting'=> array('N' => $day['veg_wetting']),
'solar_rad'=> array('N' => $day['solar_rad']),
'ob_temp'=> array('N' => $day['ob_temp']),
'adj_min'=> array('N' => $day['adj_min']),
'chill_hours'=> array('N' => $day['chill_hours'])
),
));
}
You can potentially do like:
if ($yourValue) {
$params['yourKey'] = array(
'Action' => 'PUT',
'Value' => array(
Type::STRING => $yourValue
)
);
}
$response = $Client->updateItem(array(
"TableName" => "tableName",
"Key" => array(
"Id" => array(
Type::STRING => $Id
)
),
"AttributeUpdates" => $params
)
);
Set all the params that are available in loop and will update only those values which is available
Hope that helps

Aramex Rate calculator APT returning error code "ISE01"

The Aramex Rate calculator API is returning the error code ISE01 and and the following error message:
Internal Server Error has occurred while getting calculating rate` while requesting
What it the reason for this error?
The following is the sample code for the Aramex rate calculator API:
<?php
$params = array(
'ClientInfo' => array(
'AccountCountryCode' => 'JO',
'AccountEntity' => 'AMM',
'AccountNumber' => '00000',
'AccountPin' => '000000',
'UserName' => 'user#company.com',
'Password' => '000000000',
'Version' => 'v1.0'
),
'Transaction' => array(
'Reference1' => '001'
),
'OriginAddress' => array(
'City' => 'Amman',
'CountryCode' => 'JO'
),
'DestinationAddress' => array(
'City' => 'Dubai',
'CountryCode' => 'AE'
),
'ShipmentDetails' => array(
'PaymentType' => 'P',
'ProductGroup' => 'EXP',
'ProductType' => 'PPX',
'ActualWeight' => array('Value' => 5, 'Unit' => 'KG'),
'ChargeableWeight' => array('Value' => 5, 'Unit' => 'KG'),
'NumberOfPieces' => 5
)
);
$soapClient = new SoapClient('http://url/to/wsdl.wsdl', array('trace' => 1));
$results = $soapClient->CalculateRate($params);
echo '<pre>';
print_r($results);
die();
?>
Just download WSDL FILE, put it somewhere on your server, and change this line to correct one (fix the url!):
$soapClient = new SoapClient('http://url/to/wsdl.wsdl', array('trace' => 1));
-
Your SOAP Client simply doesn't really recognize CalculateRate command without directions...
PS. Worked for me, just tried.

PHP Betfair Free Access API, how to build APIRequestHeader & call any method?

I am trying to write a simple PHP client to get some data from Betfair through the Free Access API http://bdp.betfair.com/?option=com_content&task=view&id=33&Itemid=62
I can login & get a session token, this way
$wsdl = 'https://api.betfair.com/global/v3/BFGlobalService.wsdl';
$soapClient = new SoapClient($wsdl);
try {
$ap_param = array(
'request' =>
array(
'username' => 'my_username',
'password' => 'my_password',
'productId' => '82',
'ipAddress' => '',
'locationId' => '',
'vendorSoftwareId' => '',
),
);
$response = $soapClient->__call("login", array($ap_param));
...
$response is an object containing the sessionToken param
But after several tries I am afraid I am sending the APIRequestHeader param (http://bdp.betfair.com/docs/) malformed, cause the response to any call (getAllEventTypes, for instance) is always returning the same: NO_SESSION
One try...
$ap_param = array(
'request' =>
array(
'header' => array(
'session_token' => $response->Result->header->sessionToken,
'clientStamp' => 0,
),
),
);
Another try...
$ap_param = array(
'request' =>
array(
'session_token' => $response->Result->header->sessionToken,
'clientStamp' => 0,
),
);
And lot of other tries... but
$response = $soapClient->__call("getAllEventTypes", array($ap_param));
$response is always the same
stdClass Object
(
[Result] => stdClass Object
(
[header] => stdClass Object
(
[errorCode] => NO_SESSION
[minorErrorCode] =>
[sessionToken] =>
[timestamp] => 2013-11-09T08:41:01.015Z
)
[eventTypeItems] =>
[minorErrorCode] =>
[errorCode] => API_ERROR
)
)
Someone here has faced the same problem?
Stupid typo error there...
session_token should be sessionToken
$ap_param = array(
'request' =>
array(
'header' => array(
'sessionToken' => $response->Result->header->sessionToken,
'clientStamp' => 0,
),
),
);

Categories