Dylan Cross
Dylan Cross

Reputation: 5986

Some PHP functions work on localhost, but not VPS

these lines of code work fine on my localhost, but not on my VPS hosting:

$url = "http://gdata.youtube.com/feeds/api/videos/".$videoID;
$doc = new DOMDocument;
$doc->load($url);
$title = $doc->getElementsByTagName("title")->item(0)->nodeValue; 
$description = $doc->getElementsByTagName("description")->item(0)->nodeValue;

I can't figure out why they would work on localhost and not my vps which is set up like the exact same as localhost.

Upvotes: 0

Views: 209

Answers (1)

deceze
deceze

Reputation: 522042

http://199.192.203.137/phpinfo.php

DOM is explicitly disabled there: --disable-dom.

Either contact your host and ask them to enable DOM (unlikely), use a different host or rewrite your code using another DOM/XML library.

Upvotes: 2

Related Questions