Solved

Web Services; Sending POST Data

Posted on 2007-11-14
4
1,141 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

708 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now