Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7983199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T10:53:36+00:00 2026-06-04T10:53:36+00:00

I am trying to go through a basic curl example. I have a php

  • 0

I am trying to go through a basic curl example. I have a php file running on a server that seems to have curl properly installed and I have another empty text document on the server that I am trying to have information copied to. When I run the script by opening the php file, no information is written to the text file.

For the server, it says curl is enabled:

curl
cURL support    enabled
cURL Information    libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5

Here is the php file I am trying to run:
http://www.php.net/manual/en/curl.examples-basic.php

<?php

$ch = curl_init("http://www.example.com/");
$fp = fopen("example_homepage.txt", "w");

curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);

curl_exec($ch);
curl_close($ch);
fclose($fp);
?>

I have an empty file named “example_homepage.txt” in the same folder. Any idea what is going wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T10:53:38+00:00Added an answer on June 4, 2026 at 10:53 am

    Your script is working perfectly. A quick test with curl example.com shows that it returns no output. If you want to actually fetch content, try a real site like $ch = curl_init("http://www.google.com/");.

    The address “www.example.com” is just that, an example. You’re meant to replace it with something real.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to implement basic communication through sockets, what I have now is: server
I am trying to get a basic blue-channel website running through fcgi, I have
The basic problem I'm trying to solve is that I have a mix of
I have an SVN repository that is configured to use Basic authentication through Apache
I am trying to work my way through basic iPhone programming and I have
I'm trying to write a script that will search through a html file and
I have a For Each loop written in Visual Basic that's trying to modify
I am trying to hit a web service through suds that requires basic auth
I'm trying to teach myself C++, and I'm going through a basic exercise about
I am trying to proxy through php for a JS RSS feed. The company

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.