Sorry if this is too remedial or repetitive in any way but I need some advice. I'm a PHP guy and I've been asked to create a container-type app to capture our yahoo! store orders data, which is sent as xml using this DTD:
http://help.yahoo.com/l/us/yahoo/smallbusiness/store/order/retrieve/retrieve-20.html
The Y! Store wants us to specify a URL on our web server to send the XML data to, and here is their example:
http://lib.store.yahoo.net/lib/vw/OrderList.xml
But am I missing something here? I've worked with simplexml_load_file() to parse XML files. But what do I need to build a web service here? How do I GET the data? I'm not even sure if Y! is sending it as a POST or how to validate it.
Do I need additional documentation on their end? If anyone can point me in the right direction, I'd appreciate it.
Thanks in advance,
-Bob
I'm never one to answer my own questions but I just thought I'd leave this for someone else some day down the road, considering Y! isn't the best with documentation on this.
The orders export from Y! Store is straight XML, not SOAP. If sent to an Apache server, you're in luck -- it's a simple $_POST. So all you need is:
$variable = file_get_contents("php://input");
In my case, however, things were complicated with IIS so I had to add HTTP verb, open up the folder permissions, etc.
-Good coding, all
Being a PHP guy have nothing to do with understanding webserves. Webservices isn't really have a POST or GET, it sending an envelope (XML), and expecting a response, also in XML.
You need to learn how to use SoapClient on PHP, here is a good place to start:
http://php.net/manual/en/soapclient.soapclient.php
Validation is something you do before sending the soap request, and validation of what is being sent back from Y! is also done by you. Hope this help you get started.
Related
I have researched APIs and I generally understand how they work and how to use them (HTTP request to API, get data and parse it, etc.), however, for my project I need to use data that I collected myself so I can't just use another database for example. I'm quite new to this so I don't understand a few things. I'll try to explain my plan as clearly as possible. Please let me know if any additional explanation is required.
I have an HTML form which can be filled out and saved. This form is not supposed to be local, but rather on a server
I read a lot about XML-files and API's and I also saw many similar questions on here but I'm not sure what applies to my instance.
I wanted to store the information from the form in an XML-file. Some people said, that this could be done with JavaScript, some people said this would require some server-side script. What applies in this case? I would guess that I need a server-side script but as I said, I'm kinda at loss here.
I thought I could simply use JavaScript to store whatever is entered into the form and use python or php to create an XML-file in which I store this information. This XML-file would then be used by the API. This is were I have trouble understanding.
The edited form is supposed to be saved (on the server I guess, so several people can access it), so you can go back to it later and edit it again. How exactly would I implement an API here? Can I just "make" my own XML-file, which the API uses as database? Is there any better way to do this?
I know this probably seems like a stupid question but I really want to understand this so bear with me. I'm very much overwhelmed by this task so I appreciate any help.
Hi im doing a billing system for a page. i need to echo a image, ISO/IEC 18004:2000, (PDF?)
Wich is generated using this format:
?re=XAXX010101000&rr=XAXX010101000&tt=1234567890.123456&id=ad662d33-6934-459c-a128-
BDf0393f0f44
They have give me an URL:
www.url.com/webservice/webservice/server32_salesPartner.php?wsdl
Url.com is to hide the real wsdl any, way, i have read here:
http://www.tutorialspoint.com/wsdl/wsdl_example.htm
http://www.tutorialspoint.com/wsdl/wsdl_introduction.htm
And other stuff.. But I can't figure out how to "send" the info, i know info is not really sent, but here is where i get lost
Do i have to build a URL after server32_salesPartner.php??, how?
Like this:
www.url.com/webservice/webservice/server32_salesPartner.php?re=XAXX010101000&rr=XAXX010101000&tt=1234567890.123456&id=ad662d33-6934-459c-a128-
BDf0393f0f44
How do i get the image then? I'm lost here.
i ask here cause the web service provider is really bad, lazy and i have been waiting for an answer for 3 days, and need to move on faster on this.
Sorry im really newbie at wsdl.
You are trying to call a soap service with rest. That won't work. Check if there is any framework for php that read the wsdl and creates a client for you. The other way is to write this client by yourself and call the SOAP with appropriate SOAP protocol.
I am in risk of being very criticized over this question, because it might have been answered here, but I do not know to look right for it. I tried to get an answer in Foruns, but people bother to show up and say "I don't know".
I usually use TIdHTTP to call a remote PHP script and receive some data, but only when I need to communicate with REST server inputting the data directly as a parameter.
Now I need to send some big JSON object (encoded and much more than 255 bytes) and I do not know how to do it in Delphi. I know that it should be through POST method, but how to send it from Delphi? And how to receive it in PHP, $request[]?
I also need a way to do it and then wait for an answer from the server, in form of other JSON object, encoded of course. It should be very simple. I have a DB online and I want to trade some data encrypted.
Thank you for your help!
Delphi doesn't have a library for that purpose so you will have to use one of the REST client libraries that can be found on the web.
This one should suit your needs just nicely.
Here is an easy example showing how to use it.
I'm creating a webservice in which remote sites can send data to a PHP-based webservice. However, I'm struggling to come up with the best way of handling the incoming data.
The data will be in the form of shopping basket contents, so might include product name, price, ID, date, customer etc. There will be one line of data for each product in the basket, so there could be 20-30 lines for some customers.
Would sending the data to the webservice via GET be sensible? Is there a better option you can think of? Any input is greatly appreciated.
Thanks!
Probably not a great idea to send via get. I'd generate the basket as XML or JSON, then post it to the service. You can then write back a response on XML or JSON saying whether or not the call was successful.
A nice introduction to a RESTful API with PHP is here. I find it goes a bit overboard in some places, you can do the same with a little less code but it is nonetheless a good guide.
If the request is going to be making a change, I would not use GET. It would break GET's safety. Here's the HTTP spec on safe methods: RFC 2616.
I would recommend you look towards a REST architecture where it seems like a POST or possibly a PUT request should be used.
I am trying to write a PHP script that will get the source code of a page in my Amazon account. However, to reach that page, I must be logged in. From what I understand, I should be able to accomplish this by posting the correct request headers, and then capturing the HTML response. Is that correct? If so, I'd really appreciate it if someone could explain to me how exactly I would do this. If it's not right, I'd love to hear the correct way of doing it!
I've used Firebug to get the request and response headers I need. It's just a matter of what to do with them now. I read elsewhere on this site that you can't send a request with the PHP post method, and that perhaps using cURL is the way to go. I really know nothing about cURL, so the more info the better.
Also, feel free to point me to some useful tutorials on this topic.
Thanks!
Max
You'll probably need to log in first using cURL, get the cookies with the session ID, then re-use those cookies in the following request to the actual page you need.
That's how browsers work, re-sending cookies every time. You should mimic that.