Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

php Curl sitemap crashes

Featured Replies

Hi all, I have a problem with curl, i am using it to create a sitemap generator, when i test it it works on a few thousand links but the site i want to use the sitemap generator on as many thousands when it gets to about 14000 links it starts to go wrong, its only using basic php curl should i do anything more

 

$ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, $link);
  curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
   curl_setopt($ch, CURLOPT_TIMEOUT, 900);

 

Thank you

Could well be the server holding the target website having a wobbler due to lack of resources especially if it's using a database to dynamically generate those pages. Put a delay in the cURL loop, make it sleep a little and slow things down that may help make it more stable.

  • Author

While checking the URL's that were being display i noticed that some contained 2 slashes after the domain name so i added the following

  $link=ltrim($link, "/");
  $link="$request_url/$link";

 

This seems to have stopped the problem

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.