/    Sign up×
Community /Pin to ProfileBookmark

DOMDocument->load: howto extend timeout

Hi All

I need to load an xml document (DOMDocument->load). But sometimes it takes too long before a response is received and it fails. So my question is can I somehow extend this period ?

thnx
Luca

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@MindzaiJul 09.2010 — You mean PHP is giving you an error about max_execution_time being exceeded? If so one option is to use set_time_limit.
Copy linkTweet thisAlerts:
@NogDogJul 09.2010 — You might also consider using the cURL functions to retrieve the text (I'm assuming this is a remote URL and not a local file?), in which case there are a number of options via curl_setopt() you can set with regard to network timeouts. You would then use the loadXML() method instead of load().
Copy linkTweet thisAlerts:
@jeanlucaauthorJul 10.2010 — sounds like an interesting solution. So if I understand correctly, you download the xml file using curl, and you have to put the result in loadXML, right ?

thnx
Copy linkTweet thisAlerts:
@NogDogJul 10.2010 — sounds like an interesting solution. So if I understand correctly, you download the xml file using curl, and you have to put the result in loadXML, right ?

thnx[/QUOTE]


Yep, that's what I was thinking. Plus I've heard some claims that cURL is faster than using a URL in "regular" PHP functions, though I have no idea why that would be, nor have I tried testing it.
Copy linkTweet thisAlerts:
@jeanlucaauthorJul 10.2010 — ok, loading the xml using curl is not that much work, so I'll just benchmark both! I'll post the result when I have them

cheers
×

Success!

Help @jeanluca spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...