Loading an external xml file and then saving it into a website directory using PHP -


so found page: load external xml , save using php me out, doesn't seem work me.

i'm trying same thing loading external xml file , saving (with no changes xml file) website directories batch system. have dynamically created directories needed. ex:

/xml/en/281 

now i'm trying load company's xml files (https://thiscompany.com/xml/en/281/18511095_en.xml) , save in own directory same name, 18511095_en.xml in 281 directory.

i've been researching , getting lots of simplexml_load_file , domdocument examples i'm not getting results needed.

for sake , purposes here code: (i'm changing url of actual xml file because client doesn't want out there. edited responses below

$url = "https://thiscompany.com/xml/en/281/18511095_en.xml"; $timeout = 10;  $curl = curl_init(); curl_setopt($curl, curlopt_url, $url); curl_setopt($curl, curlopt_returntransfer, 1); curl_setopt($curl, curlopt_connecttimeout, $timeout);  $response = curl_exec($curl); file_put_contents(__dir__ . "/xml/18511095_en.xml", $response); 

i'm assuming problem savexml path. xml directory @ root of website. need include, http://www.....com? xml, en, , 281 have 0777 permissions.

any appreciated.

you need provide path on filesystem, not url.

e.g. "/var/www/www.example.com/htdocs/xml/en/281/18511095_en.xml"


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -