homepage Welcome to WebmasterWorld Guest from 54.196.196.62
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / XML Development
Forum Library, Charter, Moderators: httpwebwitch

XML Development Forum

    
XML problem
Elric99




msg:4218010
 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




msg:4218972
 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




msg:4218973
 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