예제 #1
0
 function setUp($type)
 {
     $this->_testType = $type;
     $wsdlPath = HKGMEDIALIB_WSDL_BASEDIR . $this->_testType . '.wsdl';
     $this->_client = SoapClientFactory::getClient($wsdlPath);
     $serverClassName = 'HGKMediaLib_SoapServer_' . $this->_testType;
     $this->_server = new $serverClassName();
 }
 /**
  * The constructor for the Yandex.Direct API SOAP client factory.
  * @param AdsUser $user the user which the client will use for credentials
  * @param string $version the version to generate clients for
  * @param string $server the server to generate clients for
  * @param bool $validateOnly if the clients should be created in validateOnly mode
  * @param bool $partialFailure if the service should be created in partialFailure mode
  */
 public function __construct(AdsUser $user, $version, $server, $validateOnly, $partialFailure)
 {
     $headerOverrides = array();
     if (isset($validateOnly) || isset($partialFailure)) {
         $headerOverrides['validateOnly'] = $validateOnly;
         $headerOverrides['partialFailure'] = $partialFailure;
     }
     parent::__construct($user, $version, $server, 'ydirect', $headerOverrides);
 }
 /**
  * The constructor for the AdWords API SOAP client factory.
  * @param AdsUser $user the user which the client will use for credentials
  * @param string $version the version to generate clients for
  * @param string $server the server to generate clients for
  * @param bool $validateOnly if the clients should be created in validateOnly
  *     mode
  * @param bool $partialFailure if the service should be created in
  *     partialFailure mode
  */
 public function __construct(AdsUser $user, $version, $server, $validateOnly, $partialFailure)
 {
     if ($version >= 'v201109' && $user->GetHeaderValue('clientEmail') != null) {
         throw new Exception('The header "clientEmail" is not compatible with ' . 'versions v201109 and later. Use clientCustomerId instead.');
     }
     $headerOverrides = array();
     if (isset($validateOnly) || isset($partialFailure)) {
         $headerOverrides['validateOnly'] = $validateOnly;
         $headerOverrides['partialFailure'] = $partialFailure;
     }
     parent::__construct($user, $version, $server, 'adwords', $headerOverrides);
 }
 /**
  * Gets the service by its service name.
  * @param  string            $serviceName    the service name
  * @param  SoapClientFactory $serviceFactory the service factory
  * @return SoapClient        the instantiated service
  */
 public function GetServiceSoapClient($serviceName, SoapClientFactory $serviceFactory)
 {
     return $serviceFactory->GenerateSoapClient($serviceName);
 }
 /**
  * The constructor for Google's DoubleClick for Publishers API SOAP client
  * factory.
  * @param AdsUser $user the user which the client will use for credentials
  * @param string $version the version to generate clients for
  * @param string $server the server to generate clients for
  */
 public function __construct(AdsUser $user, $version, $server)
 {
     parent::__construct($user, $version, $server, 'publisher');
 }
 /**
  * Get the compression flag
  * @return int Get the compression flag value
  */
 protected static function GetCompressionKind()
 {
     if (!isset(self::$COMPRESSION_KIND)) {
         if (version_compare(PHP_VERSION, '5.4.0', '>=') && version_compare(PHP_VERSION, '5.4.4', '<')) {
             self::$COMPRESSION_KIND = SOAP_COMPRESSION_DEFLATE;
         } else {
             self::$COMPRESSION_KIND = SOAP_COMPRESSION_GZIP;
         }
     }
     return self::$COMPRESSION_KIND;
 }
예제 #7
0
function show_fault($service)
{
    echo "\n";
    echo 'Fault: ' . $service->fault . "\n";
    echo 'Code: ' . $service->faultcode . "\n";
    echo 'String: ' . $service->faultstring . "\n";
    echo 'Detail: ' . $service->faultdetail . "\n";
}
# Define SOAP headers.
//'<clientEmail>' . WH_AW_CLIENT_EMAIL . '</clientEmail>' .
$headers = '<email>' . WH_AW_EMAIL . '</email>' . '<password>' . WH_AW_PASS . '</password>' . '<useragent>' . WH_AW_USER_AGENT . '</useragent>' . '<developerToken>' . WH_AW_DEV_TOKEN . '</developerToken>' . '<applicationToken>' . WH_AW_APP_TOKEN . '</applicationToken>';
# Set up service connection. To view XML request/response, change value of
# $debug to 1. To send requests to production environment, replace
# "sandbox.google.com" with "adwords.google.com".
$namespace = 'https://adwords.google.com/api/adwords/v13';
$estimator_service = SoapClientFactory::GetClient($namespace . '/TrafficEstimatorService?wsdl', 'wsdl');
$estimator_service->setHeaders($headers);
$debug = 0;
# Create keyword structure.
$dbr = wfGetDB(DB_SLAVE);
$cats = array("Cars & Other Vehicles", "Computers and Electronics", "Education and Communications", "Family Life", "Arts and Entertainment", "Finance and Business", "Food and Entertaining", "Health", "Hobbies and Crafts", "Holidays and Traditions", "Home and Garden", "Other", "Personal Care and Style", "Pets", "Pets and Animals", "Philosophy and Religion", "Relationships", "Sports and Fitness", "Travel", "Work World", "Youth");
foreach ($cats as $c) {
    $vol = 0;
    $res = $dbr->query("select st_title, st_id from suggested_titles where st_used=0 and st_category = " . $dbr->addQuotes($c) . " and st_traffic_volume < 0 limit 100");
    $map = array();
    echo "Doing {$c}\n";
    while ($row = $dbr->fetchObject($res)) {
        $t = Title::makeTitle(NS_MAIN, $row->st_title);
        echo "\tChecking {$t->getText()}\n";
        # Create keyword structure.
        $keyword = '<keywordText>' . htmlspecialchars($t->getFullText()) . '</keywordText>' . '<keywordType>Exact</keywordType>' . '<language>en</language>';
예제 #8
0
 */
require_once 'soapclientfactory.php';
# Provide AdWords login information.
$email = '*****@*****.**';
$password = '******';
$client_email = '*****@*****.**';
$useragent = 'Cubeophobic Inc: AdWords API PHP Sample Code';
$developer_token = 'pWA9C0yZVLeR8nXJfQNvZQ';
$application_token = 'ifqEeL10TR4l_vjzCoEV2A';
# Define SOAP headers.
$headers = '<email>' . $email . '</email>' . '<password>' . $password . '</password>' . '<clientEmail>' . $client_email . '</clientEmail>' . '<useragent>' . $useragent . '</useragent>' . '<developerToken>' . $developer_token . '</developerToken>' . '<applicationToken>' . $application_token . '</applicationToken>';
# Set up service connection. To view XML request/response, change value of
# $debug to 1. To send requests to production environment, replace
# "sandbox.google.com" with "adwords.google.com".
$namespace = 'https://adwords.google.com/api/adwords/v12';
$report_service = SoapClientFactory::GetClient($namespace . '/ReportService?wsdl', 'wsdl');
$report_service->setHeaders($headers);
$debug = 0;
# Create report job structure.
$report_job = '<selectedReportType>Keyword</selectedReportType>' . '<name>Sample Keyword Report</name>' . '<aggregationTypes>Summary</aggregationTypes>' . '<adWordsType>' . $network . '</adWordsType>' . '<keywordType>' . $match_type . '</keywordType>' . '<startDay>2008-09-23</startDay>' . '<endDay>2008-09-24</endDay>' . '<selectedColumns>Campaign</selectedColumns>' . '<selectedColumns>AdGroup</selectedColumns>' . '<selectedColumns>Keyword</selectedColumns>' . '<selectedColumns>KeywordId</selectedColumns>' . '<selectedColumns>KeywordStatus</selectedColumns>' . '<selectedColumns>KeywordMinCPC</selectedColumns>' . '<selectedColumns>KeywordDestUrlDisplay</selectedColumns>' . '<selectedColumns>KeywordTypeDisplay</selectedColumns>' . '<selectedColumns>Impressions</selectedColumns>' . '<selectedColumns>Clicks</selectedColumns>' . '<selectedColumns>CPC</selectedColumns>' . '<selectedColumns>CTR</selectedColumns>' . '<selectedColumns>Cost</selectedColumns>' . '<selectedColumns>AveragePosition</selectedColumns>';
$request_xml = '<validateReportJob>' . '<job xmlns:impl="https://adwords.google.com/api/adwords/v12" ' . 'xsi:type="impl:DefinedReportJob">' . $report_job . '</job>' . '</validateReportJob>';
# Validate report.
$report_service->call('validateReportJob', $request_xml);
if ($debug) {
    show_xml($report_service);
}
if ($report_service->fault) {
    show_fault($report_service);
}
# Schedule report.
$request_xml = '<scheduleReportJob>' . '<job xmlns:impl="https://adwords.google.com/api/adwords/v12" ' . 'xsi:type="impl:DefinedReportJob">' . $report_job . '</job>' . '</scheduleReportJob>';
예제 #9
0
					  echo 'String: ' . $service->faultstring . "\n";
					  echo 'Detail: ' . $service->faultdetail . "\n";
					}
					
					
                    $headers =
                      '<email>' . $email . '</email>'.
                      '<password>' . $password . '</password>' .
                      '<clientEmail>' . $client_email . '</clientEmail>' .
                      '<useragent>' . $useragent . '</useragent>' .
                      '<developerToken>' . $developer_token . '</developerToken>' .
                      '<applicationToken>' . $application_token . '</applicationToken>';
                  
				  	$namespace = 'https://adwords.google.com/api/adwords/v13';
					$account_service =
					  SoapClientFactory::GetClient($namespace . '/AccountService?wsdl', 'wsdl');
					$account_service->setHeaders($headers);
					$debug = 0;
				  
					$account_info = $account_service->call('getAccountInfo');
					$account_info = $account_info['getAccountInfoReturn'];
					
					if($account_info['customerId']!='')
						{
							?>
					
                    			<div style="display:block; background-color:#DDFFDD; color:#00AA00; padding:5px;"><strong>Connected to Google API Successfully</strong></div>     
                            
                            <?php						
						}
					else
예제 #10
0
 public function __construct($object)
 {
     $adapterType = substr(get_class($this), 23, strlen(get_class($this)) - 34);
     $this->_soapClient = SoapClientFactory::getClient(HKGMEDIALIB_WSDL_BASEDIR . $adapterType . '.wsdl');
 }
<?php

require_once '../../../conf/config.php';
$SoapServer = SoapClientFactory::getClient(HKGMEDIALIB_WSDL_BASEDIR . 'UrnResolver.wsdl');
//echo var_export($SoapServer->__getFunctions());
//var_export ($SoapServer->add());
//var_export ($SoapServer->delete(NULL, NULL, "urn://provider/collection/signature/media2/sequence1"));
var_export($SoapServer->resolve(NULL, 'urn://provider/collection1/*/media1/*'));
//var_export ($SoapServer->update(NULL, NULL, 'urn://provider/collection/signature/media1/sequence1', 'path6'));
//var_export ($SoapServer->add('urn_master', NULL, 'collection1', 'signature1', 'media2', 'sequence1', 'path9', 'provider'));