EDIT:
I've decided to totally change how I put this to you guys. I'm using the script provided by Amazon to connect to the Alexa API and get some information. I have a table in my database that I'm pulling rows from (by the URL) and using this script to try to update some columns that are currently blank with this gathered information.
The example below is showing the results I get for http://google.com
I hope I've worded this right and haven't been too confusing.
The following code:
public static function parseResponse($response) {
$xml = new SimpleXMLElement($response,null,false,
'http://awis.amazonaws.com/doc/2005-07-11');
if($xml->count() && $xml->Response->UrlInfoResult->Alexa->count()) {
$info = $xml->Response->UrlInfoResult->Alexa;
$nice_array = array(
'Phone Number' => $info->ContactInfo->PhoneNumbers->PhoneNumber,
'Owner Name' => $info->ContactInfo->OwnerName,
'Email' => $info->ContactInfo->Email,
'Street' => $info->ContactInfo->PhysicalAddress->Streets->Street,
'City' => $info->ContactInfo->PhysicalAddress->City,
'State' => $info->ContactInfo->PhysicalAddress->State,
'Postal Code' => $info->ContactInfo->PhysicalAddress->PostalCode,
'Country' => $info->ContactInfo->PhysicalAddress->Country,
'Links In Count' => $info->ContentData->LinksInCount,
'Rank' => $info->TrafficData->Rank
);
}
echo '<pre>';
print_r(array_values($nice_array));
echo '</pre>';
}
Will output this:
Array
(
[0] => SimpleXMLElement Object
(
[0] => unlisted
)
[1] => SimpleXMLElement Object
(
[0] => aa
)
[2] => SimpleXMLElement Object
(
[0] => dns-admin@google.com
)
[3] => SimpleXMLElement Object
(
[0] => aa
)
[4] => SimpleXMLElement Object
(
[0] => unlisted
)
[5] => SimpleXMLElement Object
(
[0] => unlisted
)
[6] => SimpleXMLElement Object
(
[0] => unlisted
)
[7] => SimpleXMLElement Object
(
[0] => unlisted
)
[8] => SimpleXMLElement Object
(
[0] => 3555997
)
[9] => SimpleXMLElement Object
(
[0] => 1
)
)
As you can see, each of these "objects" correspond to the code above, showing Phone Number, Owner Name, Email, Street, City, State, Postal Code, Country, Links In Count, and Rank, respectively.
What I need to do is take each value and update that row in my database.