Jump to content

file_get_contents getting 500 Error


db323c

Recommended Posts

Trying to create a script to grab all the threads from a forum and put them in a db to search through later. Everything seems to work except that I get a 500 internal server error after 5-10 minutes.

 

 

      set_time_limit(0);

       mysql_query("Truncate table forumindex");

        //#of threads
for($x=1; $x<40000; $x++)
{	
        //multiple forums
	for($i=0; $i<4; $i++)
	{	
	        //initial thought was a timeout issue, so I tried to solve that.
		$ctx = stream_context_create(array(
		    ‘http’ => array(
		        ‘timeout’ => 3
		        )
		    )
		);
		$handle = file_get_contents("http://*********.com/boardthread?id=" . $forum[$i] . "&thread=" . $x, null, $ctx);


		if($handle)
		{
			//code  to add to db. which works.				
		}
	}		
}

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.