I have an XML File for an API. The API responses everytime "Errormesage: Expected argument of type "string", "array" given".
$SimpleXML_loaded_File = simplexml_load_file("http://graphics.edc-internet.nl/b2b_feed.php?key=tc62te28wt3e2t73ctr9c1cw42601337&sort=xml&type=xml&lang=de"); foreach ($SimpleXML_loaded_File->product as $product) { /*$client->post('articles', array( 'name' => $product->titel, 'taxId' => 1, 'supplier' => $product->merk, 'mainDetail' => array( 'number' => $product->artikelnummer ) ));*/ echo "<pre>"; var_dump($product->artikelnummer); echo "</pre>"; } If i var_dump the Output i dont get a string i`m getting the object
object(SimpleXMLElement)#6 (1) { [0]=> string(7) "0633178" } How do i get only the string ?
var_dump()is not asking for a string value specifically, so you might just have chosen the wrong function. You might haven been looking forstrval()instead. Or many of the other string functions in PHP.