Welcome to WebmasterWorld Guest from 107.20.54.98

Forum Moderators: httpwebwitch

Message Too Old, No Replies

XML problem

     
6:43 pm on Oct 17, 2010 (gmt 0)

Junior Member

10+ Year Member

joined:May 7, 2005
posts: 143
votes: 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);

?>
7:34 pm on Oct 19, 2010 (gmt 0)

Moderator This Forum from CA 

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

joined:Aug 29, 2003
posts:4059
votes: 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?
7:35 pm on Oct 19, 2010 (gmt 0)

Moderator This Forum from CA 

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

joined:Aug 29, 2003
posts:4059
votes: 0


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

[php.net...]
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members