How to create a webservice for the conversion rate - php

I would like to create a SOAP Web service for the followıng wsld
http://www.webservicex.com/CurrencyConvertor.asmx?WSDL
Could you please explain how to do this?
The following code is not working... Please help me..
ini_set("soap.wsdl_cache_enabled", "0");
$client = new SoapClient("http://www.webservicex.com/CurrencyConvertor.asmx?wsdl");
$CURR = array("FromCurrency" => "USD","ToCurrency" => "INR");
$scramble = $client->ConversionRate($CURR);
$mirror = $client->ConversionRateResponse($scramble);
Thanks,
Praveen J

Let's start with your client URL:
http://www.webservicex.com/CurrencyConvertor.asmx?wsdl
This is wrong. The ?WDSL URL is NOT the URL you use for CALLING the web service, it is the URL you use to retrieve the WDSL that describes the web service. THis is used by automatic tools to generate a wrapper.
http://www.webservicex.com/CurrencyConvertor.asmx
is the "real" URL that you use to execute operations.
http://www.webservicex.com/CurrencyConvertor.asmx?op=ConversionRate
Has a more invormation on the conversion per se, including the exact parameters with naming you need for the Post and GET operations, including examples.

Related

Delete track on soundcloud using the API with PHP

I'm trying to delete a track on soundcloud via their API. I'm using the Njasm php library for sound cloud (not an official one as I don't think they have an official one).
I can upload fine but I'm not 100% sure how to delete a track.
I have this:
$params = array("id"=>255008920);
$response = $facade->delete("/tracks", $params);
But this does not seem to delete the track.
What do I have to use (even if it's not based on the Njasm library) to delete a track?
I'm the creator of the njasm library.
First of all thanks for using it.
In regard to your question: You are calling the right method with the right parameters, but you need to call the
request()
method in the end, to invoke the API. Assumming you're authenticated.
Example:
$facade = new SoundcloudFacade($clientID, $clientSecret);
$facade->userCredentials($username, $password);
$params = ["id" => 12345];
$response = $facade->delete('/tracks')->request();
// or
$facade->delete('/tracks');
$facade->setParams($params);
$response = $facade->request();
Hope it helps.
To use delete functionality you will need to use OAuth authentication.
This might point you in the right direction
https://apigee.com/console/soundcloud?apig_cc=1

Access to API's

I have a web-service.
I try to create a Soap Client in php like this:
<?php
$client = new SoapClient("link.svc?wsdl",array("trace"=>1,"exceptions"=>0));
print_r($client);
$parameters = array("request"=>array("function" => "request1"));
$values = $client->FindSomething($parameters);
print_r($values);
?>
and then use std_Object Class.
I try in this way, but I know there are other ways to create a client and obtain data (eg. in Json Rest).
This is the first time I do this. If someone already has experience, can give me an example of request (in json or php, does not matter)? Thank you in advance!

how to use GET to obtain info from a URL

I'm a php programmer but I'm new to APIs.
I would like to run a mysql query to get info from an XML document from madmimi.com.
documentation from madmimi.com says
GET http://madmimi.com/audience_lists/lists.xml will return the data I need. I've created a php file and connected to their API using
require(dirname(FILE) . '/MadMimi.class.php');
$mailer = new MadMimi('username', 'password');
but I don't understand how to use GET to connect to the URL and display the XML info?
What do I need to do?
All http api interaction is hidden to you behind their library. You can use it's methods to grab objects, like this to lists:
$mailer->Lists();
There is no complete documentation, but you can read raw code to search urls, described in API for finding appreciated methods.
You can use curl to get the response from the 3rd party api. Have a look at this answer:
https://stackoverflow.com/a/5159513/1369567
Based upon the code in answer given at that link, you may need to the code to match your request. E.g:
/* Script URL */
$url = 'http://madmimi.com/audience_lists/lists.xml';
/* $_GET Parameters to Send */
$params = array('username' => '*your api username*', 'password' => '*your api password*');

Twitter API post statuses/filter with Twitter OAuth Class

I keep getting error code 34 (Sorry, this page does not exist) when attempting to make a post request to the statuses/filter method with the abraham twitteroauth class (https://github.com/abraham/twitteroauth). Following authentication (that's working fine) my request is simple:
$filter = $twitteroauth->post('statuses/filter',array('track' => 'seo'));
I have other calls working but even when I isolate this on a separate instance of the site, I'm only receiving the "Sorry, that page does not exist" error.
Any help would be appreciated.
TwitterOAuth does not currently support the Streaming APIs. You can try the method that #JohnC suggests but I don't know if it will actually work.
Phirehose is the PHP library I recommend for use with the Streaming APIs.
The statuses/filter call uses a different URL to many of the other API calls - using stream.twitter.com instead of api.twitter.com. The library you are using appears to be hardcoded to only use api.twitter.com, so this could be the source of your problem. You can either change the URL for that call:
$twitteroauth->host = "https://stream.twitter.com/1/";
$filter = $twitteroauth->post('statuses/filter',array('track' => 'seo'));
Or if you use the full URL it will override the default (probably the best way if you make multiple calls to the $twitteroauth class):
$filter = $twitteroauth->post('https://stream.twitter.com/1/statuses/filter.json',array('track' => 'seo'));

UPS API PHP - End point URL

I have downloaded a PHP SDK for the UPS API. I have the following code and have no idea what an end point URL is. The documentation does not provide any information on what this is.
//Configuration
$access = "0C81234564C2567";
$userid = "leannetest";
$passwd = "456hththd8hf";
$accessSchemaFile = "schemas/AccessRequest.xsd";
$requestSchemaFile = "schemas/RateRequest.xsd";
$responseSchemaFile = "schemas/RateResponse.xsd";
$endpointurl = 'add URL here';
$outputFileName = "XOLTResult.xml";
Can anyone help?
Endpoint url explaination in the UPS document. it consists of four parts which are explained below.
For example if we are going to use "Rate" service than our urls should be as below.
Testing and integration URL : https://wwwcie.ups.com/ups.app/xml/Rate
Production URL : https://onlinetools.ups.com/ups.app/xml/Rate
As per the documentation if we devide the url in four parts all of them are as listed below.
Protocol : https
Name of server : wwwcie.ups.com (testing) OR onlinetools.ups.com (production)
Path of service : ups.app/xml/Rate
name of the service : Rate OR Ship OR QVEvents
I just replied to explain UPS endpoint url in detail so it might help
An API endpoint "defines the address or connection point to a Web service. It is typically represented by a simple HTTP URL string". So basically, the endpoint URL is the URL of the web service that are you attempting to interact with.
SOURCE:
http://en.wikipedia.org/wiki/Web_Services_Description_Language#Objects_in_WSDL_1.1_.2F_WSDL_2.0
EDIT: It appears from the documentation that the Rate webservices endpoint URL is https://wwwcie.ups.com/webservices/Rate.
SOURCE:
UPS. (January 2, 2002). Rating Package Web Services Developers Guide. Section 1.9.3 Server Availability Check. Accessed in Rating API found on this page: https://www.ups.com/upsdeveloperkit/downloadresource?loc=en_US
The shipping endpoint url is:
https://wwwcie.ups.com/webservices/Ship
In case anyone needs it, since it's not documented in their developers kit.
Indeed the documentation is poor but with a little google trick I got the list of all the endpoint URLs
Type in google search:
site:https://onlinetools.ups.com/ups.app/xml/
In this way, it will show you all the endpoints.
Note: Do not use the sandbox URLs because they don't work at all :(
Anyway, here is the list:
https://onlinetools.ups.com/ups.app/xml/TimeInTransit
https://onlinetools.ups.com/ups.app/xml/License
https://onlinetools.ups.com/ups.app/xml/QVEvents
https://onlinetools.ups.com/ups.app/xml/Register
https://onlinetools.ups.com/ups.app/xml/AV
https://onlinetools.ups.com/ups.app/xml/ShipAccept
https://onlinetools.ups.com/ups.app/xml/Void
https://onlinetools.ups.com/ups.app/xml/XAV
https://onlinetools.ups.com/ups.app/xml/Track
https://onlinetools.ups.com/ups.app/xml/Rate
https://onlinetools.ups.com/ups.app/xml/ShipConfirm
https://onlinetools.ups.com/ups.app/xml/LabelRecovery
I hope this help

Categories