CURL Request Stopped working

For years I've been running a daily curl script that tracks stock quotes through Yahoo finance.  Just the other day the CURL request stopped working.

The URL that I'm using works fine in a browser and gives me the option of downloading the CSV. Here is the URL:

If you click on this link it will ask you about opening a CSV file on your computer which gives the exact fields that I want.

Previously this worked fine using a CURL request. But as of last Thursday something changed.  It may be that Yahoo changed something or my PHP version may have been upgraded on my hosting server which caused something to not work.  

Here's the code that worked fine until last Thursday.

       $url = "";
	$ch = curl_init(); 
	curl_setopt($ch, CURLOPT_URL, $url); 
	curl_setopt($ch, CURLOPT_HEADER, 0); 
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
	$var = curl_exec($ch); 
	print 'CURL RESPONSE: <textarea cols=100 rows=25>'.$var.'</textarea>'; die ("at stockPull stop point");

Open in new window

In the past, this textarea would show the same data that you see from going straight to the URL. But now it just gets caught in a loop that gives an error message in the logs of:
mod_fcgid: read data timeout in 120 seconds, referer:
Premature end of script headers: look.php, referer:

Any insight into why the CURL request no longer works would be appreciated.

Paul KonstanskiProject SpecialistAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

It works for me, but then, no changes were done on my system recently. Did anyone change any parameters/config files/settings to your webserver? Maybe even update some components (apache/php)?
Also, run Wireshark (on the machine where the PHP is located), to see the exact traffic to and from Yahoo. If the request really times out, a browser (on that same machine) should theoretically also time out.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Paul KonstanskiProject SpecialistAuthor Commented:
Thanks for testing it.

It got me thinking that maybe I should test on one of my other servers which I did and it works fine.

I'm doing some research to see if I can determine what setting on the machine may have changed.
Ray PaseurCommented:
cURL returns error information when it fails.  If you want to see a code sample that will help visualize it, please post a Q and I'll be glad to show you what PHP can tell you about.
Paul KonstanskiProject SpecialistAuthor Commented:

I posted the question here:

The points away... :)


It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.