www.webdeveloper.com
Results 1 to 3 of 3

Thread: Working with xml in php

  1. #1
    Join Date
    Jan 2006
    Posts
    14

    Working with xml in php

    Here is the .php script:
    PHP Code:
    $ch curl_init();

        
    $headers2 = array(
        
    'HTTP/1.0 GET',
        
    'Accept: application/xml',       
        
    'Content-Type: application/xml'  
      
    );

      
    curl_setopt($chCURLOPT_URL"https://app.streamsend.com/audiences/1/people.xml?email_address=test@email.com");
      
    curl_setopt($chCURLOPT_SSL_VERIFYPEERfalse);
      
    curl_setopt($chCURLOPT_HTTPHEADER$headers2);
      
    curl_setopt($chCURLOPT_USERPWD"9a8nvy39wu:9678h4vt59a87");
      
    curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
      
      
    $response curl_exec($ch);
     
      echo 
    "$response"
    It outputs this as $response:

    Code:
    <people> 
      <person> 
        <created-at>2009-02-20T15:40:15Z</created-at> 
        <email-address>test@email.com</email-address> 
        <email-content-format>html</email-content-format> 
        <id>3</id> 
        <ip-address>69.52.437.133</ip-address> 
        <opt-status>active</opt-status> 
        <soft-bounce-count>0</soft-bounce-count> 
        <subscribed-at>2009-02-20T15:40:46Z</subscribed-at> 
        <tracking-hash encoding="base64">Skt5eTZOSQ==
    </tracking-hash> 
        <updated-at>2009-02-20T18:24:14Z</updated-at> 
        <user-agent>Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.19 (KHTML, like Gecko) Chrome/1.0.154.48 Safari/525.19</user-agent> 
        <audience-id>1</audience-id> 
      </person> 
    </people>
    Now my question is I want the contents of <id></id> to be a variable in the script to move on to the next thing it needs to do. So in other words I want the results to be I guess changed into individual variables? so that lets say it is able to make $id=3 based on the above example. Is this possible? Thanks for any help as it is greatly appreciated!

  2. #2
    Join Date
    Aug 2004
    Posts
    244

  3. #3
    Join Date
    Jan 2006
    Posts
    14
    Wow thats simple! THANK YOU

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles