IpLocation.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Service
  17. * @subpackage DeveloperGarden
  18. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id$
  21. */
  22. /**
  23. * @see Zend_Service_DeveloperGarden_Client_ClientAbstract
  24. */
  25. require_once 'Zend/Service/DeveloperGarden/Client/ClientAbstract.php';
  26. /**
  27. * @see Zend_Service_DeveloperGarden_Response_IpLocation_LocateIPResponseType
  28. */
  29. require_once 'Zend/Service/DeveloperGarden/Response/IpLocation/LocateIPResponseType.php';
  30. /**
  31. * @see Zend_Service_DeveloperGarden_Response_IpLocation_LocateIPResponse
  32. */
  33. require_once 'Zend/Service/DeveloperGarden/Response/IpLocation/LocateIPResponse.php';
  34. /**
  35. * @see Zend_Service_DeveloperGarden_Response_IpLocation_IPAddressLocationType
  36. */
  37. require_once 'Zend/Service/DeveloperGarden/Response/IpLocation/IPAddressLocationType.php';
  38. /**
  39. * @see Zend_Service_DeveloperGarden_Response_IpLocation_RegionType
  40. */
  41. require_once 'Zend/Service/DeveloperGarden/Response/IpLocation/RegionType.php';
  42. /**
  43. * @see Zend_Service_DeveloperGarden_Response_IpLocation_GeoCoordinatesType
  44. */
  45. require_once 'Zend/Service/DeveloperGarden/Response/IpLocation/GeoCoordinatesType.php';
  46. /**
  47. * @see Zend_Service_DeveloperGarden_Response_IpLocation_CityType
  48. */
  49. require_once 'Zend/Service/DeveloperGarden/Response/IpLocation/CityType.php';
  50. /**
  51. * @see Zend_Service_DeveloperGarden_Request_IpLocation_LocateIPRequest
  52. */
  53. require_once 'Zend/Service/DeveloperGarden/Request/IpLocation/LocateIPRequest.php';
  54. /**
  55. * @category Zend
  56. * @package Zend_Service
  57. * @subpackage DeveloperGarden
  58. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  59. * @author Marco Kaiser
  60. * @license http://framework.zend.com/license/new-bsd New BSD License
  61. */
  62. class Zend_Service_DeveloperGarden_IpLocation
  63. extends Zend_Service_DeveloperGarden_Client_ClientAbstract
  64. {
  65. /**
  66. * wsdl file
  67. *
  68. * @var string
  69. */
  70. protected $_wsdlFile = 'https://gateway.developer.telekom.com/p3gw-mod-odg-iplocation/services/IPLocation?wsdl';
  71. /**
  72. * wsdl file local
  73. *
  74. * @var string
  75. */
  76. protected $_wsdlFileLocal = 'Wsdl/IPLocation.wsdl';
  77. /**
  78. * Response, Request Classmapping
  79. *
  80. * @var array
  81. *
  82. */
  83. protected $_classMap = array(
  84. 'LocateIPResponseType' => 'Zend_Service_DeveloperGarden_Response_IpLocation_LocateIPResponseType',
  85. 'IPAddressLocationType' => 'Zend_Service_DeveloperGarden_Response_IpLocation_IPAddressLocationType',
  86. 'RegionType' => 'Zend_Service_DeveloperGarden_Response_IpLocation_RegionType',
  87. 'GeoCoordinatesType' => 'Zend_Service_DeveloperGarden_Response_IpLocation_GeoCoordinatesType',
  88. 'CityType' => 'Zend_Service_DeveloperGarden_Response_IpLocation_CityType',
  89. );
  90. /**
  91. * locate the given Ip address or array of addresses
  92. *
  93. * @param Zend_Service_DeveloperGarden_IpLocation_IpAddress|string $ip
  94. * @return Zend_Service_DeveloperGarden_Response_IpLocation_LocateIPResponse
  95. */
  96. public function locateIP($ip)
  97. {
  98. $request = new Zend_Service_DeveloperGarden_Request_IpLocation_LocateIPRequest(
  99. $this->getEnvironment(),
  100. $ip
  101. );
  102. $result = $this->getSoapClient()->locateIP($request);
  103. $response = new Zend_Service_DeveloperGarden_Response_IpLocation_LocateIPResponse($result);
  104. return $response->parse();
  105. }
  106. }