Solved

Web Services; Sending POST Data

Posted on 2007-11-14
4
1,145 Views
Last Modified: 2012-06-21
I have an external web service. I use SimpleXML to read the results of that service. The web service docs tell me that I have to pass parameters as POST variables. How do I do that?

(Php Code Attached)

How can I send $parameters to the web service via POST to get the right result.
<?php
$webServicePath = "http://web.service.url/path.php";
$parameters = "...";
 
$result = simplexml_load_file($webServicePath);
?>

Open in new window

0
Comment
Question by:lexxwern
  • 2
4 Comments
 
LVL 12

Author Comment

by:lexxwern
ID: 20287248
Also which Php-Ajax library/class would you recommend. Am lookign for some really simple and intuitive.

Thanks,
0
 
LVL 48

Expert Comment

by:hernst42
ID: 20287361
I recommend http://www.xajaxproject.org. Easy simple to use from php and has all you need.

To send post data you need to use curl to fetch the result and then use simplexml_load_string()
See http://www.php.net/curl
0
 
LVL 21

Accepted Solution

by:
nizsmo earned 500 total points
ID: 20287701
You can also send post data without CURL if you don't have the extension:
http://netevil.org/blog/2006/nov/http-post-from-php-without-curl

also a good tutorial about how to use curl to send post-data:
http://www.askapache.com/htaccess/sending-post-form-data-with-php-curl.html

Hope this helps.
0
 
LVL 12

Author Closing Comment

by:lexxwern
ID: 31409287
Great stuff, thanks.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question