Hey guys, I'm using a social login API and I'm trying to grab the XML details for a specific user I already have the token of:
This brings back a XML of everything I need, I'm just having trouble scraping the data between
and
I've been to every cURL tutorial site and can't seem to figure it out, all the regular expressions are throwing me off...anything helps
oh, and yes, I have to use cURL the site said....can't fetch or use DOM
Code:
<?php
//Your Site Settings
$site_subdomain = 'mywebsite';
$site_public_key = 'mystuff';
$site_private_key = 'mystuff';
//API Access Domain
$site_domain = $site_subdomain.'.api.com';
//Connection Resource
$resource_uri = 'https://'.$site_domain.'/users/'.$token.'.xml';
//Setup connection
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $resource_uri);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_USERPWD, $site_public_key . ":" . $site_private_key);
curl_setopt($curl, CURLOPT_TIMEOUT, 15);
curl_setopt($curl, CURLOPT_VERBOSE, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 1);
curl_setopt($curl, CURLOPT_FAILONERROR, 0);
//Send request
$result_xml = curl_exec($curl);
curl_close($curl);
//Done
echo "$result_xml";
?>
This brings back a XML of everything I need, I'm just having trouble scraping the data between
Code:
<displayName>Awesome Guy</displayName>
Code:
<emails>
<value>superduper@emailhere.com</value>
I've been to every cURL tutorial site and can't seem to figure it out, all the regular expressions are throwing me off...anything helps
oh, and yes, I have to use cURL the site said....can't fetch or use DOM