I'm trying to use the latest PHPToolKit (2023_1) to read/update some records but am having an issue right out of the gate. When trying to look up a contact with their email address, I'm getting the error:
PHP Fatal error: Uncaught SoapFault exception: [soapenv:Server.userException] The request could not be understood by the server due to malformed syntax. in /var/www/phpinclude/PHPToolkit_2023_1/PHPToolkit/NSPHPClient.php:296
The code causing this is below. I've used this code before to test connections/execution with Netsuite before and it has worked fine. In fact, it works fine if I use netsuite-php (https://github.com/netsuitephp/netsuite-php), but that uses namespaces and quite frankly, I'm not a good enough programmer to fully understand that and had issues trying to create functions to take care of tasks that I need to do in multiple scripts.
$recordRef = new RecordRef();
$recordRef->internalId = '-6'; //Internal ID for a customer is -2, contact is -6
$contactSearch = new ContactSearch(); //use CustomerSearch() for a customer
$contactSearchBasic = new ContactSearchBasic();//SearchRecordBasic
$contactSearchBasic->email = new SearchStringField();
$contactSearchBasic->email->searchValue = '[email protected]';
$contactSearchBasic->email->operator = SearchStringFieldOperator::is;
$contactSearch->basic = $contactSearchBasic;
$searchRequest = new searchRequest(); //% contains a searchRecord
$searchRequest->searchRecord = $contactSearch;
$searchResponse = $ns->search($searchRequest);
print_r ($searchResponse);
Google only returned one result of a person who seemed to be having the same issue, but there was no solution. I looked thru many posts that might be similar, but no luck. Usually I can follow the error message and locate the problem, but this message isn't pointing me anywhere.
Server is:
- CentOS Stream 8
- Apache 2.4.37
- PHP 7.4.33 (php-fpm)
If someone can point me in the right direction, it would be greatly appreciated.