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 684193
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:47:22+00:00 2026-05-14T01:47:22+00:00

Answer : Implemented using Curl… $file = http://abc.com/data//output.txt; $ch = curl_init($file); $fp = @fopen(out.txt,

  • 0

Answer : Implemented using Curl…

$file = "http://abc.com/data//output.txt";
$ch = curl_init($file);
$fp = @fopen("out.txt", "w");
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
curl_close($ch);
fclose($fp);
$file = "out.txt";
$fp = fopen($file, "r");

I am trying to parse data from a pipe-delimited text file hosted on another server which in turn will be inserted in a database. My host (1and1) disabled allow_url_fopen in php.ini I guess.

Error message :

Warning: fopen() [function.fopen]: URL file-access is disabled in the server configuration in

Code :

    <?


// make sure curl is installed
if (function_exists('curl_init')) {
   // initialize a new curl resource
   $ch = curl_init(); 

   // set the url to fetch
   curl_setopt($ch, CURLOPT_URL, 'http://abc.com/data/output.txt'); 

   // don't give me the headers just the content
   curl_setopt($ch, CURLOPT_HEADER, 0); 

   // return the value instead of printing the response to browser
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 

   // use a user agent to mimic a browser
   curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0'); 

   $content = curl_exec($ch); 

   // remember to always close the session and free all resources 
   curl_close($ch); 
} else {
   // curl library is not installed so we better use something else
}

//$contents = fread ($fd,filesize ($filename));

//fclose ($fd); 
$delimiter = "|";
$splitcontents = explode($delimiter, $contents);
$counter = "";
?>
<font color="blue" face="arial" size="4">Complete File Contents</font>
<hr>
<?
echo $contents;
?>

<br><br>
<font color="blue" face="arial" size="4">Split File Contents</font>
<hr>
<?
foreach ( $splitcontents as $color )
{

$counter = $counter+1;
echo "<b>Split $counter: </b> $colorn<br>";
}

?>

WordPress has this cool http.php file. Is there a better way of doing it? If not, how do I use http.php for this task? Thank you guys..

  • 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-05-14T01:47:23+00:00Added an answer on May 14, 2026 at 1:47 am

    Try file_get_contents(), or the CURL library.

    This article has some examples: Reading a Remote File Using PHP

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

Sidebar

Related Questions

I've found this topic which I've implemented (see accepted answer): javascript equivalent of PHP's
Inspired by the encoding scheme of the answer to this question , I implemented
I'm having trouble figuring out how to implement the code from this answer. Android:
ANSWER: You cannot write an int directly to a file. Convert it to a
Large part of squeak is implemented using squeak itself. I am curious to know
Can reputation scoring system be implemented using business rule management system (BRMS), such as
I currently have a working, simple language implemented in Java using ANTLR. What I
I am using data-driven test suites running JUnit 3 based on Rainsberger's JUnit Recipes
I implemented TCP client to connect to the server using TcpClient ( C# .NET
I have search and search but no answer I am using Zend Framework to

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.