Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4039780
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T12:39:44+00:00 2026-05-20T12:39:44+00:00

I have a problem in running the cron job. here are my code: <?php

  • 0

I have a problem in running the cron job.

here are my code:

<?php
    $doc = new DOMDocument();
    $doc->load( 'http://www.all-news.in/feed' );

    $items = $doc->getElementsByTagName( "item" );

    mysql_connect('host','username','pass');
    mysql_select_db('dbname');

    $i=0;
    foreach( $items as $itemname )
    {
        // Here Business logic for Inserting the data
    }   

    echo $i.' Imported';
?>

When I run this file in browser, it works fine, but when the cron executed I have got the below error:

<br />
<b>Warning</b>:  DOMDocument::load(http://www.all-news.in/feed) [<a href='domdocument.load'>domdocument.load</a>]: failed to open stream: Connection timed out in <b>/home/content/98/7509598/html/amz/social-bookmark.in/cron_jobs/all_news.php</b> on line <b>4</b><br />
<br />
<b>Warning</b>:  DOMDocument::load() [<a href='domdocument.load'>domdocument.load</a>]: I/O warning : failed to load external entity &quot;http://www.all-news.in/feed&quot; in <b>/home/content/98/7509598/html/amz/social-bookmark.in/cron_jobs/all_news.php</b> on line <b>4</b><br />
0 Imported
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T12:39:45+00:00Added an answer on May 20, 2026 at 12:39 pm

    I tried your code out and I’m not getting any errors. I modified it a bit to give me some more feedback:

    error_reporting(E_ALL);
    $doc = new DOMDocument();
    $doc->load( 'http://www.all-news.in/feed' );
    
    $items = $doc->getElementsByTagName( "item" );
    var_dump($items);
    // mysql_connect('host','username','pass');
    // mysql_select_db('dbname');
    
    $i=0;
    foreach( $items as $itemname )
    {
        var_dump( $itemname ); $i++;
        // Here Business logic for Inserting the data
    }   
    
    echo $i.' Imported';
    

    This gives me:

    object(DOMNodeList)#2 (0) { } object(DOMElement)#3 (0) { } object(DOMElement)#5 (0) { } object(DOMElement)#3 (0) { } object(DOMElement)#5 (0) { } object(DOMElement)#3 (0) { } object(DOMElement)#5 (0) { } object(DOMElement)#3 (0) { } object(DOMElement)#5 (0) { } object(DOMElement)#3 (0) { } object(DOMElement)#5 (0) { } 10 Imported
    

    If you’re testing on a local environment (your laptop perhaps) then try restarting your web server. Other than that I’m not sure what’s wrong sorry.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's a problem I keep running into: I have a lot of situations where
I have a table with 200 rows. I'm running a cron job every 10
I have an odd problem in VS2008 running unit tests. When I run the
1st phase I have a problem shutting down my running JBoss instance under Eclipse
Has anyone encountered the following problem: I have IIS7 running on my computer. On
Problem solved: Thanks guys, see my answer below. I have a website running in
I have been having some problems trying to get my PHP running. When I
Looking for some direction here as I'm running into some migration problems. We have
Okay, so here's my problem: I have a list of members on a website,
I have a Swing Application running under Linux, that has problems to display accented

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.