Comments (5)
What is $sEmail being set as? It looks like the issue might be with value or type.
from php-sdk.
$string = <<<XML
<FMG_Records>
<FMG_Record>
<UniqueIdentifier></UniqueIdentifier>
<FirstName>John</FirstName>
<LastName>Doe</LastName>
<Email>[email protected]</Email>
</FMG_Record>
</FMG_Records>
XML;
$xml = simplexml_load_string($string);
$sEmail = $xml->FMG_Record->Email;
It is coming through as a string, so far as I can tell. print $sEmail; gives me:
With no extra characters.
from php-sdk.
$sEmail is still a SimpleXMLElement with 1 child object at position 0 in this case:
var_dump($sEmail);
object(SimpleXMLElement)#4 (1) {
[0]=>
string(15) "[email protected]"
}
var_dump($sEmail . '');
string(15) "[email protected]"
On Dec 5, 2013, at 9:47 PM, jorgenpr [email protected] wrote:
$string = <<<XML
<FMG_Records>
<FMG_Record>
John
Doe
[email protected]
</FMG_Record>
</FMG_Records>
XML;$xml = simplexml_load_string($string);
$sEmail = $xml->FMG_Record->Email;
It is coming through as a string, so far as I can tell.—
Reply to this email directly or view it on GitHub.
from php-sdk.
Thanks, specifically casting it with
$sEmail = (string)$xml->FMG_Record->Email;
Fixed the error!
from php-sdk.
You can cast it either with the (string) cast, or by using the __toString() method (which is called when casting it).
Also for the initial check to see if it is a valid or not empty email, you can use the filter_var method (this will ensure it is a valid email address or return false):
if(filter_var($sEmail, FILTER_VALIDATE_EMAIL)) {
/* ... */
}
from php-sdk.
Related Issues (20)
- Resubscribe contact with OPTOUT status HOT 6
- Inconsistencies in example code HOT 2
- Composer Compatibility Issue
- Zombie Emails HOT 3
- Bad Request Using v3
- When use to PHP_CodeSniffer check source get some error?
- getVerifiedEmailAddresses HOT 2
- 3.0.0-alpha - cannot update contact returned from HOT 1
- 3.0.0-alpha
- Catchable fatal error: Argument 1 must be of the type array, string given HOT 1
- The query parameter email is not supported. HOT 2
- php-sdk 3.0.0-alpha: How to get contact Id (how to unsubscribe contact from specific list by email)? HOT 1
- remove git from your composer packages
- error 400 bad request when submitting from form HOT 1
- Is this project abandoned? HOT 4
- Get Bad request when we remove contact
- Problem create Contact
- guzzle compatibility on php 7 HOT 5
- Incorrect @return type
- This repository is no longer maintained!
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php-sdk.