Fix php script problem

Job ID: 32042849

Budget: $10 – $30 USD

A long time ago I hired a developer to make a script for me. Now I got some issues with the script today.

The script collects data from an XML link. The information I got I put in my MySQL database and send an email of every new event. The script also checks if the information is changing and updated the information. And then send a new email.

In the script I collect information from two sources, one is the information from an XML link of accidents and another one is a checkup for lat and long also XML output.

Problem is that the script stops working sometimes. I don't know exactly why I don't get the error code all the time.

What I understand is that the XML data is not correct. You will need to change the script so instead of XML it should use JSON. I can get JSON output from the sources. You need also to modify the script with different CURLOPT_REFERER to make it work. A full debug would be good to make all problems go away.

Error code:
Warning: SimpleXMLElement::__construct(): Entity: line 6: parser error : Opening and ending tag mismatch: hr line 5 and body in C:\wamp64\www\sos_sr.php on line 119

Warning: SimpleXMLElement::__construct(): </body> in C:\wamp64\www\sos_sr.php on line 119

Warning: SimpleXMLElement::__construct(): ^ in C:\wamp64\www\sos_sr.php on line 119

Warning: SimpleXMLElement::__construct(): Entity: line 7: parser error : Opening and ending tag mismatch: body line 3 and html in C:\wamp64\www\sos_sr.php on line 119

Warning: SimpleXMLElement::__construct(): </html> in C:\wamp64\www\sos_sr.php on line 119

Warning: SimpleXMLElement::__construct(): ^ in C:\wamp64\www\sos_sr.php on line 119

Warning: SimpleXMLElement::__construct(): Entity: line 8: parser error : Premature end of data in tag html line 1 in C:\wamp64\www\sos_sr.php on line 119

Warning: SimpleXMLElement::__construct(): in C:\wamp64\www\sos_sr.php on line 119

Warning: SimpleXMLElement::__construct(): ^ in C:\wamp64\www\sos_sr.php on line 119

Fatal error: Uncaught Exception: String could not be parsed as XML in C:\wamp64\www\sos_sr.php:119 Stack trace: #0 C:\wamp64\www\sos_sr.php(119): SimpleXMLElement->__construct('<html>\r\n<head><...') #1 C:\wamp64\www\sos_sr.php(251): paginationSR('https://api.sr....') #2 {main} thrown in C:\wamp64\www\sos_sr.php on line 119
Related categories: PHP XML MySQL JSON cURL