Solved

Web Services using nusoap

Posted on 2003-11-09
3
232 Views
Last Modified: 2008-03-03
The code below is intented to provide me with capacity to consume a webservice with textanywhere.net.

I would like to enable the capability to check the validity of a Mobile Phone Number that could be located anywhere in the world.  On execution, I get no response.  I'm sure that my code is not correct.  Can someone identify what is wrong with it.  the code for the webservice is located         at: http://ws.textanywhere.net/ta_sms.asmx
live example at: http://ws.textanywhere.net/sample.asp

I am using php

Michael Senyonjo
==============================================
 <?php
/* Coucou les copains :) c'est trop facile le php :)
* Company Information
* This script is a webservice client that consumes the webservice with
* WSDL document at http://www.flash-db.com/services/ws/companyInfo.wsdl
* http://ws.textanywhere.net/ta_sms.asmx
* Given any mobile phone number, it queries the webservice for information about
* that number  and it retrieves the results from the webservice
* for display.
*
* A live demo of this program can be found at
* http://ws.textanywhere.net/sample.asp
*
*
*/

 // Include the NuSOAP soap toolkit file.
require_once('nusoap.php');

 // Create a SOAP Client object.
 $client = new soapclient("http://ws.textanywhere.net/TA_WS");

 // The following is a mechanism for capturing the stock symbol we want
 // to lookup. You can change this as required.
 $number = $_GET['number'];

 // Arguments for the webservice.
 $param = array ("username"=>"Lxxxxx3", "pyyyyyd"=>"51xo0n3", "ticker"=>$number);

 // Call the webservice "textanywhere.net/TA_WS" method with the arguments.
 $results = $client->call("textanywhere.net/TA_WS", $param);

 /* $results is an array with the following structure

*/

 // We would now format the data for output in HTML.
 $html = "<html>\n<head>\n<title>Mobile Phone Number Information. Webservice client - Written by: Tim Akinbo</title>\n</head>\n";
 $html .= "<body>\n";
 $html .= "<table cellpadding=\"1\" cellspacing=\"0\" border=\"0\" width=\"300\" bgcolor=\"#CCCCCC\">\n<tr>\n";
 $html .= "<td><font face=\"Tahoma, Arial\" size=\"2\">&nbsp;Mobile Phone Number Information</font></td>\n";
 $html .= "</tr>\n<tr>\n<td>\n<table cellpadding=\"4\" cellspacing=\"0\" border=\"0\" width=\"100%\" bgcolor=\"#FFFFFF\">\n<tr>\n";
 $html .= "<td><font face=\"Tahoma, Arial\" size=\"1\"><strong>Phone Number</strong></font></td><td><font face=\"Tahoma, Arial\" size=\"1\"><strong>Country</strong></font></td><td><font face=\"Tahoma, Arial\" size=\"1\"><strong>Credit Available</strong></font></td>\n</tr>\n";

 $color = "#000000";

 // $color is set to green if we have an appreciation in value (number is present in $results['textanywhere.net/TA_WS'])
 //if (preg_match("/^\+/", $results['changePercent'])) $color = "#00CC33";
 //if ($number == ($results = $client->call("textanywhere.net/TA_WS", $param))  $color = "#00CC33";
 if (preg_match("$number", $results['textanywhere.net/TA_WS'])) $color = "#00CC33";

 // else it is set to red if we have a depreciation ("-")
 //if (preg_match("/^-/", $results['changePercent'])) $color = "#FF0000";

 $html .= "<tr>\n<td><font face=\"Tahoma, Arial\" size=\"1\">" . $results['number'] . "</font></td><td><font face=\"Tahoma, Arial\" size=\"1\">" . $results['country'] . "</font></td><td><font face=\"Tahoma, Arial\" size=\"1\" color=\"$color\"><strong>" . $results['credit'] . "</strong></font></td>\n</tr>\n";
 $html .= "</table>\n</td>\n</tr>\n</table>\n</body>\n<form method=get action=".$PHP_SELF."><font face=\"Tahoma, Arial\" size=\"1\"><strong>Number to Call : (must start with '+')</strong></font><input type=text name=number><input type=submit value=Check Number></form></html>";

 echo $html;
?>

Michael
==========
0
Comment
Question by:Senyonjo
3 Comments
 
LVL 13

Accepted Solution

by:
lozloz earned 250 total points
Comment Utility
try replacing <form method=get action=".$PHP_SELF."> with <form method=get action=".$_SERVER["PHP_SELF"].">

loz
0

Featured Post

Easy Project Management (No User Manual Required)

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
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…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

763 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

11 Experts available now in Live!

Get 1:1 Help Now