Number of ways to read xml file from another server in PHP?

I am trying to read an XML file from another server. However, the company that accepts me seems to have turned the file_get_contents function of extracting files for files from other servers (and their support is not very bright, and they always need to be answered). So I need work in some way.

This is my current code.

 $url =  urldecode( $object_list_url );
 $xmlstr = file_get_contents ( $url );
 $obj = new SimpleXMLElement ( $xmlstr, LIBXML_NOCDATA );
+3
source share
3 answers

You can use cURL (if it is not disabled). Something like that:

$c = curl_init($url);
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
$xmlstr = curl_exec($c);
+8
source

In ini var you mean allow_url_fopen. To check, run this script:

var_dump(ini_get('allow_url_fopen'));

Ask your host to enable this ini value (if it is disabled, it is enabled by default).

URL- .

, copy . , ini, .

0

Is it possible to execute the following script and provide the information as a comment?

<?php
phpinfo();
?>
0
source

Source: https://habr.com/ru/post/1698817/


All Articles