error Trying to get property of non-object

Problems with the Linux version of XAMPP, questions, comments, and anything related.

error Trying to get property of non-object

Postby wama_mms » 07. May 2012 01:50

Hello

I am working on my graduation project and I have a critical problem with my php code and I am just beginner in php coding.

I am reading from text file IDs of papers and want to link between the ID that I read form my text file and the XML file so that is my code :
<?php
$file = fopen("abstract/Temp_id.txt","r");
$ids;
while(!feof($file))
{
$ids = fgets($file);

$xml = simplexml_load_file("abstract/$ids");//abstract is the folder which I save my files and //read from it

$title="bibliomisc =".$xml->articleinfo[0]->bibliomisc;

echo $title;
echo"<a href=abstract/$ids title='Click to open :)'>$ids</a>";
}
fclose($file);
?>

BUT I worked on openssl and it is working if I give it the name of ID e.g.
$xml = simplexml_load_file("abstract/8104317");//it is working but if I read from file I got that error


Warning: simplexml_load_file() [function.simplexml-load-file]: I/O warning : failed to load external entity "8104317.xml " in /opt/lampp/htdocs/GP/xml_test.php on line 9

Notice: Trying to get property of non-object in /opt/lampp/htdocs/GP/xml_test.php on line 12

Notice: Trying to get property of non-object in /opt/lampp/htdocs/GP/xml_test.php on line 12
bibliomisc =
8104317.xml
Warning: simplexml_load_file() [function.simplexml-load-file]: I/O warning : failed to load external entity "" in /opt/lampp/htdocs/GP/xml_test.php on line 9

Notice: Trying to get property of non-object in /opt/lampp/htdocs/GP/xml_test.php on line 12

Notice: Trying to get property of non-object in /opt/lampp/htdocs/GP/xml_test.php on line 12
bibliomisc =

help please :) thanks
wama_mms
 
Posts: 1
Joined: 07. May 2012 01:48
Operating System: ubuntu

Re: error Trying to get property of non-object

Postby JonB » 09. May 2012 16:55

your issue is here;

Warning: simplexml_load_file() [function.simplexml-load-file]: I/O warning : failed to load external entity "" in /opt/lampp/htdocs/GP/xml_test.php on line 9

I'll bet the argument has to be in URL format.

Good Luck
8)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7


Return to XAMPP for Linux

Who is online

Users browsing this forum: No registered users and 16 guests