Hello,
I’m having trouble with curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1). My code is working perfectly in localhost, but not on the server.
Basically, I don’t want to display any result on the screen when I use curl_exec($ch).
My code consists of a loop that downloads files from a site (the download urls are contained in an array) and renames it. When I run the codes on the server, curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1) works for the first few times, but it’s always printing at least 1 result to the screen when using curl_exec($ch). I’ve tried pasting curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1) everywhere but still the same result.
Also, when there’s only 1 url in the loop, nothing is printed on the screen.
Please help.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
You may also need to set curl_setopt($ch, CURLOPT_VERBOSE, 0); to prevent the verbose output to screen.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.