Jump to content

Recommended Posts

im using the code

 

$ch = curl_init();
			$timeout = 30; // set to zero for no timeout
			$useragent="Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1";
			curl_setopt ($ch, CURLOPT_URL, $url);
			curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
			curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
			curl_setopt ($ch, CURLOPT_USERAGENT, $useragent);
			$f = curl_exec($ch);
			curl_close($ch);			

		$xml = simplexml_load_string($f, 'SimpleXMLElement', LIBXML_NOCDATA);

 

to pull xml data from a website and the array im getting has @attributes as a key header.. like this

SimpleXMLElement Object
(
    [@attributes] => Array
        (
            [categoryId] => 92
            [dateCompleted] => 2009-02-12-07:00
            [desc] => Sample 50 different kinds of Azeroth's delectable dishes.
            [icon] => inv_misc_food_115_condorsoup
            [id] => 1832
            [points] => 10
            [title] => Tastes Like Chicken
        )

    [criteria] => SimpleXMLElement Object
        (
            [@attributes] => Array
                (
                    [maxQuantity] => 50
                    [quantity] => 53
                )

        )

)

 

and i cant get this data out of the array i have tryed everything but nothing is working ... any one have any ideas...

Link to comment
https://forums.phpfreaks.com/topic/148691-array-formatting-issue/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.