Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

Nico Du Plessis
Nico Du Plessis
16,637 Points

php curl wsdl xml request error

Hi there, I am trying to consume a web service using a url like: http://192.168.48.21:8099/wsa/wsa1/wsdl?targetURI=urn:bars-com:DTAGSA-otaping.

This service accepts xml code. I use curl to access the url. I store the xml in a variable called $xml and the url in $url.

I get an error back "No resources found at the requested path: /wsa/wsa1/wsdl"

What am I missing? I am sure there is syntax or parameter problem, but I can't find it.

$headers = array( "Content-type: text/xml", "Content-length: " . strlen($xml), "Connection: close", ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $xml); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$data = curl_exec($ch); echo $data; if(curl_errno($ch)) print curl_error($ch); else curl_close($ch);