Fatal error: Cannot redeclare class soapclient in /home/selfstor/pu...

6 posts / 0 new
Last post
#1 Mon, 26 Jun 2006 19:31
Anonymous (not verified)

Fatal error: Cannot redeclare class soapclient in /home/selfstor/pu...

I'm sure I changed something in the code, but I'm not sure how or when it happened. When anyone tries to send a fax through our web site, it doesn't even get past this point. I made sure the nusoap.php file wasn't altered and it's fine. Honestly, I know it's a simple fix, but I don't know where to look.

Here is the error message I get:

Fatal error: Cannot redeclare class soapclient in /home/selfstor/public_html/nusoap.php on line 7240

Tue, 27 Jun 2006 09:43
Adam M

NuSOAP error message can be caused by a thousand different things that are unrelated to NuSOAP's code.

I'm afraid that to debug this you'll need to start from the most basic fax submission method, and work your way up from there. To get quickly up and running use our PHP + NuSOAP faxing samples.

Tue, 27 Jun 2006 19:39
Metzae (not verified)

I Googled my problem and found a completely unrelated site that had the answer. I'm posting it here in case anyone else has the same problem.

http://forums.vtiger.com/archive/o_t__t_2335__fatal-error-cannot-redeclare-class-soapclient-....html

Skeemer's response near the bottom worked for me. I have no idea how or why it worked, but it did.

Wed, 28 Jun 2006 07:01
Adam M

(quoted from here: ) The problem is that the class SoapClient was added into PHP5. The quickfix that I made and works is changing in nusoap.php, "soapclient" to "soapclient2" in the class and constructor lines and then changing all instances of "new soapclient" to "new soapclient2" in [applications-specific files].

This would imply that you are using PHP5 along with NuSOAP. Please note that there is no need to rename soapclient to soapclient2 in NuSOAP. In fact, there is no need for NuSOAP in PHP5.

SOAP is already built into PHP5, so there is no need for an external SOAP library such as NuSOAP. Here's a snippet of code for PHP5:

<?php
// This runs on PHP5 using internal SOAP 

$client = new SoapClient("http://ws.interfax.net/dfs.asmx?wsdl");
$faxResult = $client->SendCharFax(array(    "Username"    => "********", 
                                            "Password"    => "********", 
                                            "FaxNumber"   => "+448707301444", 
                                            "Data"        => "Hello World", 
                                            "FileType"    => "TXT"));
print_r($faxResult);
?>

Looking forward, please note that if you need to fax binary file types, like DOC or XLS, you will NOT need to base64_encode these because PHP5's SOAP extension does this for you.

Mon, 28 Aug 2006 21:32
Metzae (not verified)

Okay, so my temporary fix didn't work and I came back to the forum to find this last post, which has really been a lot of help. The problem, I discovered, is that my host is using PHP 4.4.1 or something similar...not PHP 5. Should I just ask them to upgrade to the new PHP, or how does that work?

Tue, 29 Aug 2006 07:54
Adam M

There is no need to upgrade to PHP5 - just use PHP4 + NuSOAP. See our PHP samples page again for these and let me know if you run into any specific problems.

Log in or register to post comments

Contact us today

Talk to a member of our team about the benefits InterFAX can bring to your organization's communications processes.

Contact us today