I’ve seen quite some topics about this issue, but nothing is really useful to me so forgive me for starting yet another topic about this.
My website runs about 20 cURL cycles in order to get build up. I like cURL because you can hide content away but crawlers can see it. I had a problem with using includes so I had to use cURL as the replacement. Each time cURL gets loaded with an URL with parameters. All URL’s are linking to local php files.
At average the website requires four seconds to load.
Is there a way to speed this up?
There are a few problems you will come across using cURL, rather than using standard PHP includes. Here is a summary.
Queuing – with 20 requests to execute in your code, each request will delay the creation of your page. The request comes with its own overheads in terms of waiting and loading.
Database – rather than opening a connection to the database, grabbing all your data and closing the connection, you will need to open a connection perhaps 20 times (depending on whether the pages need database access). Creating and releasing a connection will cost you time.
I would wager that whatever you are doing with cURL you could do with an include. When you include a file in PHP it has access to all of the variables that are currently in scope – so you don’t need to pass them in a querystring, you can just use them from the second file…
example.php
other.php