simplexml

How to parse an xml sitemap using PHP Curl and individually load each url

霸气de小男生 提交于 2020-01-21 00:38:09
问题 I am trying to write a script that will read a remote sitemap.xml and parse the url's within it, then load each one in turn to pre-cache them for faster browsing. The reason behind this: The system we are developing writes DITA XML to the browser on the fly and the first time a page is loaded the wait can be between 8-10 seconds. Subsequent loads after that can be as little as 1 second. Obviously for a better UX, pre-cached pages are a bonus. Every time we prepare a new publication on this

Import XML in PHP to add to Mysql DB

吃可爱长大的小学妹 提交于 2020-01-17 16:38:23
问题 I've been trying to crack this one and just haven't been able to. Basically I have an XML file that contains train line timetable information, and it is really complex. I need to capture every bit of information and add to a MySQL DB, but as you'll see the parent/child and key/pair is quite dynamic and sometimes it has more or less stuff. I have been looking a SimpleXML, but cannot get the values out of the XML, in a way it is flexible to the change in information/data. Please note that from

Import XML in PHP to add to Mysql DB

假如想象 提交于 2020-01-17 16:32:28
问题 I've been trying to crack this one and just haven't been able to. Basically I have an XML file that contains train line timetable information, and it is really complex. I need to capture every bit of information and add to a MySQL DB, but as you'll see the parent/child and key/pair is quite dynamic and sometimes it has more or less stuff. I have been looking a SimpleXML, but cannot get the values out of the XML, in a way it is flexible to the change in information/data. Please note that from

Import XML in PHP to add to Mysql DB

邮差的信 提交于 2020-01-17 16:32:27
问题 I've been trying to crack this one and just haven't been able to. Basically I have an XML file that contains train line timetable information, and it is really complex. I need to capture every bit of information and add to a MySQL DB, but as you'll see the parent/child and key/pair is quite dynamic and sometimes it has more or less stuff. I have been looking a SimpleXML, but cannot get the values out of the XML, in a way it is flexible to the change in information/data. Please note that from

Copy XML attributes PHP

妖精的绣舞 提交于 2020-01-17 08:16:58
问题 I need to work with XML documents and I need to copy some fields to another XML file. I have this field: <cast> <person name="Nanda Anand" character="" job="Director" id="589088" thumb="" department="Directing" url="http://www.themoviedb.org/person/589088" order="0" cast_id="1000"/> <person name="Lynn Collins" character="" job="Actor" id="21044" thumb="http://cf2.imgobject.com/t/p/w185/berS11tKvXqTFThUWAYrH279cvn.jpg" department="Actors" url="http://www.themoviedb.org/person/21044" order="0"

php Dynmically format xml to php array [closed]

徘徊边缘 提交于 2020-01-17 05:26:27
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . Hi I was wondering if anyone knows a script or function that can format any xml file to a array in a specific format such as having a xml something like this (but much longer) <data> <width>3.5</width> <height>2<

finding children in php simplexml xpath

爱⌒轻易说出口 提交于 2020-01-16 03:14:12
问题 I am running an xpath query on an xml stream and retreiving a set of data. In that i need to find the tag name. But im not able to find the way to retrieve the tag name. The xml stream is <Condition> <Normal dataItemId="Xovertemp-06" timestamp="2011-09-02T03:35:34.535703Z" name="Xovertemp" sequence="24544" type="TEMPERATURE"/> <Normal dataItemId="Xservo-06" timestamp="2011-09-02T03:35:34.535765Z" name="Xservo" sequence="24545" type="LOAD"/> <Normal dataItemId="Xtravel-06" timestamp="2011-09

simplexml_load_string not parsing my XML string. Charset issue?

五迷三道 提交于 2020-01-15 10:44:14
问题 I'm using the following PHP code to read XML data from NOAA's tide reporting station API: $rawxml = file_get_contents( "http://opendap.co-ops.nos.noaa.gov/axis/webservices/activestations/" ."response.jsp?v=2&format=xml&Submit=Submit" ); $rawxml = utf8_encode($rawxml); $ob = simplexml_load_string($rawxml); var_dump($ob); Unfortunately, I end up with it displaying this: object(SimpleXMLElement)#246 (0) { } It looks to me like the XML is perfectly well-formed - why won't this parse? From looking

PHP SimpleXML asXML writes ANSI encoded file

人走茶凉 提交于 2020-01-15 02:37:46
问题 I am trying to write some content into an XML file, yet I do have problems with special characters. The content I'd like to write is submitted to the script via $_GET , so I assume it is properly decoded into UTF-8 content. $write = $_GET['content']; will be fed like: file.php?content=s%F6per In the PHP I do the following: $xml = simplexml_load_file('file.xml'); $newentry = $xml -> addChild('element',$write); $xml -> asXML($xml_filename); The XML file that is opened is UTF-8 encoded. When I

Call to undefined function simplexml_load_file()

夙愿已清 提交于 2020-01-13 10:37:10
问题 I have php 7.0 running on my ubuntu server. php -m command says: [PHP Modules] calendar Core ctype curl date dom exif fileinfo filter ftp gd gettext hash iconv intl json libxml mbstring mcrypt mysqli mysqlnd openssl pcntl pcre PDO pdo_mysql Phar posix readline Reflection session shmop SimpleXML sockets SPL standard sysvmsg sysvsem sysvshm tokenizer wddx xml xmlreader xmlwriter xsl Zend OPcache zip zlib But still when I run my website, its log says " PHP Fatal error: Call to undefined function