Expedia API showing "cannot service this request.Authentication failure" error - php

I am new in EAN development. I am developing hotel booking system in PHP using EAN. I want to fetch the reservation details from EAN API.
Following is my code:
$itinerary = xxxxxx;
$cid = 55505;
$minorRev = 13;
$apiKey = "y2dfnyvwbwkvgth76hfjdej7";
$locale = "en_US";
$currencyCode = "USD";
$customerSessionId;
$customerUserAgent;
$customerIpAddress;
$url = "http:api.ean.com/ean-services/rs/hotel/v3/";
$urlBook = "https:book.api.ean.com/ean-services/rs/hotel/v3/";
$url = ($service == 'res') ? $urlBook : $url;
$url .= $service
. "?minorRev={$minorRev}"
. "&cid={$cid}"
. "&apiKey={$apiKey}"
. "&customerUserAgent=" . rawurlencode($customerUserAgent)
. "&customerIpAddress={$customerIpAddress}"
. "&customerSessionId={$customerSessionID}"
. "&locale={$locale}"
. "&currencyCode={$currencyCode}";
$xml = "
<HotelItineraryRequest>
<itineraryId>{$itinerary}</itineraryId>
<email>customer#mail.com</email>
</HotelItineraryRequest>
";
$curl = new Curl();
$info = $curl->exec($xml, $url, "ItinerarySearch");
print_r($info);
It showing the following error :
Cannot service this request.Authentication failure
What is the problem with this code. Is there any solution that how can I get Reservation details from EAN.
I use the demo php code library from expedia : http://developer.ean.com/code_library/samples/PHP_Booking
Thanks in advance.

Related

QBO API v3 PHP call returns NULL

I'm using the qbo-api-v3 for PHP to authenticate and retrieve a Balance Sheet report via PHP script. This has been working just fine over the last 6 months, but recently stopped returning data (returns NULL for repsonseCOde, responseBody, and responsArray). I can't figure out why - any ideas? Thanks!
// qbo API
require_once dirname(__FILE__).'/../v3-php-sdk-2.2.0-RC/config.php';
require_once(PATH_SDK_ROOT . 'Core/ServiceContext.php');
require_once(PATH_SDK_ROOT . 'PlatformService/PlatformService.php');
require_once(PATH_SDK_ROOT . 'Utility/Configuration/ConfigurationManager.php');
require_once(PATH_SDK_ROOT . 'Core/CoreHelper.php');
require_once(PATH_SDK_ROOT . 'DataService/Batch.php');
require_once(PATH_SDK_ROOT . 'DataService/IntuitCDCResponse.php');
require_once(PATH_SDK_ROOT . 'Data/IntuitRestServiceDef/IPPAttachableResponse.php');
require_once(PATH_SDK_ROOT . 'Data/IntuitRestServiceDef/IPPFault.php');
require_once(PATH_SDK_ROOT . 'Data/IntuitRestServiceDef/IPPError.php');
require_once('RestServiceHandler.php');
require_once(PATH_SDK_ROOT . 'Core/OperationControlList.php');
// QBO Service Context
$serviceType = IntuitServicesType::QBO;
$oauth['AccessToken'] = ...
$oauth['AccessTokenSecret'] = ...
$oauth['ConsumerKey'] = ...
$oauth['ConsumerSecret'] = ...
$oauth['RealmID'] = ...
$requestValidator = new OAuthRequestValidator(ConfigurationManager::AppSettings('AccessToken'),
ConfigurationManager::AppSettings('AccessTokenSecret'),
ConfigurationManager::AppSettings('ConsumerKey'),
ConfigurationManager::AppSettings('ConsumerSecret'));
$serviceContext = new ServiceContext($oauth['RealmID'], $serviceType, $requestValidator); //d($serviceContext);
if (!$serviceContext) exit("Problem while initializing ServiceContext.\n");
// query for Balance Sheet Report - https://developer.intuit.com/docs/api/accounting/balance%20sheet
$report = 'BalanceSheet';
$query = "start_date=$start_date&end_date=$end_date";
$uri = "company/{1}/reports/$report?{2}";
$uri = str_replace("{1}", $oauth['RealmID'] , $uri);
$uri = str_replace("{2}", $query , $uri);
// Creates request parameters
$requestParameters = new RequestParameters($uri,'GET',CoreConstants::CONTENTTYPE_APPLICATIONJSON, NULL);
$restRequestHandler = new RestServiceHandler($serviceContext);
// Make the request
list($responseCode,$responseBody) = $restRequestHandler->GetReportsResponse($requestParameters, NULL, NULL);
$responseArray = json_decode($responseBody, true);

when i use sendMessage() method to send message in chat when i am using telegram bot in group automatically reply last message

when i use sendMessage() method to send message in chat when i am using telegram bot in group automatically reply last message
how can i solve this?
[enter image description here][1]
function Start($obj_tblTemp, $Token) {
$Keyboard = array(
'keyboard' => array(
array(INSERT_EXPENSE, DELETE_EXPENSE),
array(EXPENSE_SITUATION, RULES_AND_HELP),
array(CANCEL)
)
);
$Key_board = json_encode($Keyboard);
$url = 'https://api.telegram.org/bot' . $Token . '/sendMessage?text='. $obj_tblTemp->get_message() . '&chat_id=' . $obj_tblTemp->get_chat_Id() . '&reply_markup=' . $Key_board;
file_get_contents($url);
}
also above problem exist in below function:
function InsertExpenseMode($obj_tblTemp, $Token, $con, $obj_tblTempLatestSession) {
if ($obj_tblTemp->get_message() == INSERT_EXPENSE) {
$url = 'https://api.telegram.org/bot' . $Token . '/sendMessage?text='
. INSERT_EXPENSE_INSTRUCTION . '&chat_id=' . $obj_tblTemp->get_chat_Id();
file_get_contents($url);
} else {
if (is_numeric($obj_tblTemp->get_message()) && $obj_tblTemp->get_message() > 0) {
$url = 'https://api.telegram.org/bot' . $Token . '/sendMessage?text='
. $obj_tblTemp->get_message() . '&chat_id=' . $obj_tblTemp->get_chat_Id();
file_get_contents($url);
} else {
$url = 'https://api.telegram.org/bot' . $Token . '/sendMessage?text='
. NUMERAL_FAIL . '&chat_id=' . $obj_tblTemp->get_chat_Id();
file_get_contents($url);
}
}
}
actually i send class objects to these function and want to evaluate user inputs then insert them to database, but development wasn't completed yet.

how to integrate coinbase api in php for transfer bitcoine

I want to transfer bitcoin through bitcoin address in PHP please share the proper link.
https://developers.coinbase.com/docs/merchants/payment-buttons
Try This code for transfer btc
$transaction = Transaction::send();
$transaction->setToBitcoinAddress('here btc address to transfer');
$transaction->setAmount(new Money(0.0010, CurrencyCode::BTC));
$transaction->setDescription('this is optional');
Hope it will work :
https://github.com/coinbase/coinbase-php
Here the code for php
please have a look
<?php
$guid = "GUID_HERE";
$firstpassword = "PASSWORD_HERE";
$secondpassword = "PASSWORD_HERE";
$amounta = "10000000";
$amountb = "400000";
$addressa = "1A8JiWcwvpY7tAopUkSnGuEYHmzGYfZPiq";
$addressb = "1ExD2je6UNxL5oSu6iPUhn9Ta7UrN8bjBy";
$recipients = urlencode('{
"' . $addressa . '": ' . $amounta . ',
"' . $addressb . '": ' . $amountb . '
}');
$json_url = "http://blockchain.info/merchant/$guid/sendmany?password=$firstpassword&second_password=$secondpassword&recipients=$recipients";
$json_data = file_get_contents($json_url);
$json_feed = json_decode($json_data);
$message = $json_feed->message;
$txid = $json_feed->tx_hash;
?>

update users table through object id without login in parse.com(USING REST API)

I want to update User table of DATA BROWSER using objectId(With out getting user to log in ) using following code.
But I am getting:
error({"code":101,"error":"object not found for update"})
can any one tell me what is wrong with this:
$className = "Classname";
$objectIdToEdit = $_SESSION['objectId'];
$url = 'https://api.parse.com/1/classes/' . $className . '/' . $objectIdToEdit;
$appId = '***********************';
$restKey = '***********';
$updatedData = '{"firstname":"Billie123"}';
$rest = curl_init();
curl_setopt($rest,CURLOPT_URL,$url);
curl_setopt($rest,CURLOPT_PORT,443);
curl_setopt($rest,CURLOPT_CUSTOMREQUEST,"PUT");
curl_setopt($rest,CURLOPT_RETURNTRANSFER, true);
curl_setopt($rest,CURLOPT_POSTFIELDS,$updatedData);
curl_setopt($rest,CURLOPT_HTTPHEADER, array(
"X-Parse-Application-Id: " . $appId,
"X-Parse-Master-Key: " . $restKey,
"Content-Type: application/json")
);
$response = curl_exec($rest);
echo $response;
I solved problem my self ,URL I was using is to save data
$url = 'https://api.parse.com/1/classes/' . $className . '/' . $objectIdToEdit;
I just changed URL to update data and problem is solved
$url = 'https://api.parse.com/1/' . $className . '/' . $objectIdToEdit;
thanks Ghost for editing

Getting error during Salesforce integration in PHP

I'm getting this error " Ooop! Error: Element {}item invalid at this location " at the time of calling Salesforce web service in PHP.
Bellow are my approaches:
require_once('salesforceAPI/soapclient/SforceEnterpriseClient.php');
require_once('salesforceAPI/soapclient/SforceHeaderOptions.php');
$sfdc = new SforceEnterpriseClient();
$SoapClient = $sfdc->createConnection('enterprise.wsdl.xml');
$loginResult = false;
$loginResult = $sfdc->login(USER, PASSWORD . SECURITY_KEY);
$parsedURL = parse_url($sfdc->getLocation());
define("_SFDC_SERVER_", substr($parsedURL['host'], 0, strpos($parsedURL['host'], '.')));
define("_WS_NAME_", 'salesforceAPI/Ctest');
define("_WS_WSDL_", _WS_NAME_ . '.xml');
define("_WS_ENDPOINT_", 'https://' . _SFDC_SERVER_ . '.salesforce.com/services/wsdl/class/' . _WS_NAME_);
define("_WS_NAMESPACE_", 'http://soap.sforce.com/schemas/class/' . _WS_NAME_);
$client = new SoapClient(_WS_WSDL_);
$sforce_header = new SoapHeader(_WS_NAMESPACE_, "SessionHeader", array("sessionId" => $sfdc->getSessionId()));
$client->__setSoapHeaders(array($sforce_header));
$method = $client->__getFunctions();
$wsParams = array('accName' => 'dasarathi');
$client->cInsert($wsParams);
I have no clue for solution.
It was a file path issue. Below is the rectification:
define("_WS_NAME_", 'salesforceAPI/Ctest');
// there is no such path http://soap.sforce.com/schemas/class/slesforceAPI/Ctest
define("_WS_NAMESPACE_", 'http://soap.sforce.com/schemas/class/' . _WS_NAME_);
I just redeclared the WS_NAME constant:
define("_WS_NAME_", 'Ctest');

Categories