I have permission from the site to do this so that isn't an issue and I can get the data, but I'm having some trouble with some of the data such as Synopsis and Genres. I have been able to get all the other data I need from the site. I would appreciate any help you can give me on this matter and yes I know my naming and neatness of my program can be improved upon and I'll do that, but this allows me to make sure each piece was working as I worked on this.

my code:


$xml_feed_url = 'http://myanimelist.net/anime/235';
$agent = 'x';
// Init the CURL
$curl = curl_init();
curl_setopt($curl, CURLOPT_USERPWD, 'x:x');
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);                    
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);                          
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);    
curl_setopt($ch, CURLOPT_USERAGENT, $agent);

// Setup the curl settings
curl_setopt($curl, CURLOPT_URL, $xml_feed_url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

curl_exec ($curl);

// grab the XML file
$raw_xml = curl_exec($curl);


$name = '';
$success = preg_match('#(?:<head>.*?<title>)(.*?)(?:- MyAnimeList.net</title>)#is', $raw_xml, $matches);
if($success) {
$name = $matches[1];
$name = trim($name);
echo "Title:  ";
echo $name;

// English Title
$ename = '';
$success = preg_match("#(?:English:</span>)(.*?)(?:</div>)#si", $raw_xml, $output_array9);
if (success) {
    $ename = $output_array9[1];
echo "  English:  ";
echo $ename;

$sname = '';
$success = preg_match("#(?:Synonyms:</span>)(.*?)(?:</div>)#si", $raw_xml, $output_array9);
if (success) {
    $sname = $output_array9[1];
echo "  Synonyms:  ";
echo $sname;

$success2 = preg_match("#(?:Type:</span>)(.*?)(?:</div>)#si", $raw_xml, $output_array);
if($success2) {
$type = $output_array[1];
$type = trim($type);
echo "  Type:  ";
echo $type;

$success3 = preg_match("#(?:Episodes:</span>)(.*?)(?:</div>)#si", $raw_xml, $output);
if($success3) {
$Episode = $output[1];
echo "  Episode:  ";
echo $Episode;

$success4 = preg_match("#(?:Rating:</span>)(.*?)(?:</div>)#si", $raw_xml, $out1);
if($success4) {
$Rating = $out1[1];
echo "  Rating:  ";
echo $Rating;

$success5 = preg_match("#(?:Duration:</span>)(.*?)(?:</div>)#si", $raw_xml, $pout2);
if($success5) {
$Duration = $pout2[1];
echo "  Duratoin:  ";
echo $Duration;

$success6 = preg_match_all("#(?:?genre[]=.*?>)(.*?)(?:</a>)#si", $raw_xml, $out3);
if($success6) {
    echo "  Genres:  ";
$Genre = $out3[1];  
echo $Genre; 

$success = preg_match("#(?:Synopsis:</h2>)(.*?)(?:</td>)#si", $raw_xml, $opt);
if($success) {
$Synopsis = $opt[1];
echo " apple ";
echo "  Synopsis:  ";
echo $Synopsis;


xml file:

duration as an exmaple:
<div><span class="dark_text">Duration:</span>
      24 min. per episode</div>

<div class="spaceit"><span class="dark_text">Genres:</span>
      <a href="http://myanimelist.net/anime.php?genre[]=4">Comedy</a>, 
      <a href="http://myanimelist.net/anime.php?genre[]=22">Romance</a>, 
      <a href="http://myanimelist.net/anime.php?genre[]=42">Seinen</a></div>

    <td valign="top"><h2>Synopsis</h2>Tada Banri, a newly admitted student at a private law school in Tokyo, found himself completely lost after the opening ceremony, 
    trying to find his way to the freshman orientation. At that moment, he ran into another lost freshman from the same school, Yanagisawa Mitsuo, and they hit it off
    at once. Somehow arriving at their intended goal just on time, there appeared in front of the two a beautiful girl holding a bouquet of roses. The girl then whacked
    Mitsuo across the face with the bouquet and handed the flowers over to him. "Freshman, congratulations," was all she said, and then left. The stylish, well dressed,
    perfect woman that had swung at Mitsuo was his childhood friend, Kaga Kouko. As children they had promised to marry each other one day, fulfilling their dreams. 
    In order to escape from her, Mitsuo had gone out secretly and taken the examination for this well known private college, but now she showed up in the freshman 
    orientation hall. She too had taken the law school entrance examination, catching up with him there.
    <br />
<br />
(Source: Baka-Tsuki)</td>

I appreciate the help.

Sincerely yours;


I was able to get the Synopsis to work. I need help to get the genres from the xml file.


$success6 = preg_match("#(?:<h2>Synopsis</h2>)(.*?)(?:<br />)#si", $raw_xml, $pout2);
if($success6) {
$Synopsis = $pout2[1];
echo "  Synopsis:  ";
echo $Synopsis;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.