homepage Welcome to WebmasterWorld Guest from 54.242.140.11
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / XML Development
Forum Library, Charter, Moderators: httpwebwitch

XML Development Forum

    
XML problem
Elric99

5+ Year Member



 
Msg#: 4218008 posted 6:43 pm on Oct 17, 2010 (gmt 0)

I'm trying to do something that shouldn't be too hard but I'm struggling with it.

I need to send a request to an API and get the response. I've been on with this all weekend so any help is greatly appreciated.

This is the code I'm trying.

<?php

$password = 'passwordhere';
$productCode = 'ITEMCODEHERE';
$userName = 'USERNAMEHERE';

$xmlParameters = "password=$password&productCode=productCode";

$client = new SoapClient('https://api.domain.com/');

$res = $client->GetImagesforProduct($userName,$xmlParameters);

$contentString = $res->contentString;

print($contentString);

?>

 

httpwebwitch

WebmasterWorld Administrator httpwebwitch us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4218008 posted 7:34 pm on Oct 19, 2010 (gmt 0)

U forgot the "$" in front of "productCode"

try this:

$xmlParameters = "password=" . $password . "&productCode=" . $productCode;


I'll assume that $client is defined, has a method named "GetImagesforProduct", and returns an object with a child named "contentString". Otherwise there's not much to debug.

do you have error reporting turned on?

httpwebwitch

WebmasterWorld Administrator httpwebwitch us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4218008 posted 7:35 pm on Oct 19, 2010 (gmt 0)

you may also enjoy using this nifty built-in PHP function:

[php.net...]

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / XML Development
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved