I've been working on this for the past few hours and thought I'd
share. Here is an example of how to send multiple URLs to the SEOmoz
API using PHP. The wiki states you do this by "POSTing a JSON encoded
list of URLs in your request body." So the difference is you take out
the URL from your GET string, and put it as the cURL
CURLOPT_POSTFIELDS option. But you must do a json_encode() on your
array of URLs first. See below for working code.
<pre>
<?php
$objectURL = json_encode(array("
www.youtube.com/watch?v=2jkExrrm_sQ",
"
www.youtube.com/watch?v=O2FInaOCqoo"));
echo $objectURL;
$accessID = "YOUR ACCESS ID";
$secretKey = "YOUR SECRET KEY";
$expires = time() + 300;
$stringToSign = $accessID."\n".$expires;
$binarySignature = hash_hmac('sha1', $stringToSign, $secretKey,
true);
$urlSafeSignature = urlencode(base64_encode($binarySignature));
$urlToFetch = "
http://lsapi.seomoz.com/linkscape/url-metrics/?
AccessID=".$accessID."&Expires=".$expires."&Signature=".
$urlSafeSignature;
$ch = curl_init($urlToFetch);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $objectURL);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
$contents = curl_exec($ch);
curl_close($ch);
$contents = json_decode($contents);
print("<pre>".print_r($contents, true)."</pre>");
?>
</pre>