0

I have the following code.

$final = array();
$search_for = '<POPULARITY URL';
$part = file_get_contents_curl('http://data.alexa.com/data?cli=10&dat=snbamz&url='.trim($domain));

$str = explode($search_for, $part); //ERROR HAPPENS HERE//
$str = array_shift(explode('"/>', $str[1]));
$str = explode('TEXT="', $str);
$str[1] = str_replace('" SOURCE="panel',"",$str[1]);
preg_match('#<COUNTRY CODE="(.*?)" NAME="(.*?)" RANK="(.*?)"#si', $part, $c);
$final['global_rank'] = $str[1];
$final['country_name'] = $c[2];
$final['country_rank'] = $c[3];
return $final;  

I can't seem to get this to work out without getting this error. "Strict Standards: Only variables should be passed by reference"

Joshua
  • 3
  • 2

1 Answers1

0

Looks like your dealing with XML as the output there which you can parse with php quite easily to get a node that you are looking for or loop through to get.

Could do this with PHP or Jquery there are means to parse xml https://www.w3schools.com/Php/php_xml_simplexml_read.asp https://api.jquery.com/jQuery.parseXML/

hope this helps.

Joe
  • 19
  • 2