Jump to content

Search the Community

Showing results for tags 'fopen'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








Donation Link

Found 7 results

  1. this is tricky to explain: I have a raw php script, written by someone else, that sends an email to a list extracted from a CSV file. It requires that certain values in the file be manually edited each time it's used, such as the following: $mail->setFrom('email@email.com', 'From Name'); // <==== change email address, From Name $subject = "Subject Line"; // <==== Adjust this subject $html = ' html here '; // <==== include email html MagicParser_parse("test.csv","myRecordHandler","csv|44|1|34"); // <==== change 'test.csv' file name the function is called by simply calling this email.php file in the browser. I'd like to build a form that would a) edit these values/strings on the fly and then b) call the file in the browser. The thing is, it's been a while since I've messed with PHP forms to any extent, and I can't remember how to get started on something like this. And I'm not familiar at all with fopen and fwrite to edit strings like this without messing up the existing code (there's a lot of other code in the file that needs to be left alone, obviously). I'm hoping someone can help me with a starting point - an idea on how to get this thing going - whether to build the form right in the same file or to build one in another file that posts these values to this existing file... hopefully someone can understand what I'm asking, and thank you much for your help. regards, glenn
  2. Hi, I have a few wordpress websites that I host for my clients because of the number of attacks they have been receiving lately I have implemented a .htaccess file to block any ip address that's not in the whitelist, the problem I face is everytime the client moves from location to location or there ip address changes I have to update the .htaccess file with there new ip. I'm trying to build a script where they can access a url with a key in and submit there new ip address the php script would then read the .htaccess and add the new ip, however the 'echos' in the file seem not to be echoing any information to screen and I'm faced with a blank white screen can anyone give me any ideas on how to do this or have alook at the script below I have wrote. <?php if (isset($_GET('key')) && $_GET('key') = '78J89ke93k93HJ883j003') { $htaccess = '.htaccess'; //read the entire file $str = file_get_contents($htaccess); //delete deny from all from file $str = str_replace('deny from all', '', $str); $ip = 'allow from ' . $_get('ip'); //'allow from'; $str .= $ip; //re add deny from all to end of file $str .= "\n" . 'deny from all'; if(file_put_contents($htaccess, $str)){ echo 'IP ' . $ip . ' Added to .htaccess file'; } } else { echo 'Invalid Key'; } ?>
  3. I'm a complete noob here, but if I have a file executing that is using fopen function (opening file, editing, then closing) on a .php file that other browsers are looking at, what will they see if they access the .php file while fopen is being executed (by cron job on my server) on it? Will the page break? The file being edited and viewed by other browsers is mostly html Any help would be greatly appreciated. Thanks
  4. Issue: Retrieving data from remote HTTP locations. "failed to open stream: HTTP request failed!" Doesn't Work: fopen(), file_get_contents(), SoapClient('[url=]http://remote_wsdl[/url]') Works: curl, wget via CLI & exec() Tried: Set all ini's to allow_url_fopen = 'On' root@OW-WS01:~$ php -v PHP 5.3.3-7+squeeze15 with Suhosin-Patch (cli) (built: Mar 4 2013 14:05:25) Copyright (c) 1997-2009 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies with Suhosin v0.9.32.1, Copyright (c) 2007-2010, by SektionEins GmbH root@OW-WS01:~# php -i --php-ini /etc/php5/apache2/php.ini | grep 'fopen' allow_url_fopen => On => On root@OW-WS01:~# grep 'fopen' -R /etc/php5/ /etc/php5/cli/php.ini:; http://php.net/allow-url-fopen /etc/php5/cli/php.ini:allow_url_fopen = On /etc/php5/apache2/php.ini:; http://php.net/allow-url-fopen /etc/php5/apache2/php.ini:allow_url_fopen = On Code Debug: ini_set('default_socket_timeout', 10); ini_set('display_errors', 1); ini_set('error_reporting', E_ALL); echo 'allow_url_fopen:' . (ini_get('allow_url_fopen') ? 'TRUE' : 'FALSE') . '<br/>'; echo 'default_socket_timeout: ' . ini_get('default_socket_timeout') . '<br/>'; $Remote_XML = "valid_path.xml"; $todays_XML = __DIR__ .'/imports/' . date( 'Ymd', time() ) . '.xml'; echo '<hr/><br/> Testing fopen()<br/>'; $from = fopen( $Remote_XML, 'r' ); $to = fopen( $todays_XML, 'w+' ); stream_copy_to_stream( $from, $to ); echo '<hr/><br/> Testing file_get_contents()<br/>'; $fgc = file_get_contents($Remote_XML); file_put_contents($todays_XML, $fgc ); echo '<hr/><br/> Testing SoapClient()<br/>'; try{ $soap = new SoapClient( '/?wsdl', array( 'trace' => TRUE ) ); $soap->login( 'user', 'pass' ); echo 'soap passed'; } catch( SoapFault $e ) { var_dump($e); } phpinfo(INFO_CONFIGURATION); Results in image format: http://i.imm.io/10Hle.png So, how do I overcome this? Have sniffed packets and these requests aren't even getting generated. This code works just dandy on local and on another server, so there's got to be something I haven't figured out yet. Any idea what could be causing this or what to try next? Thanks
  5. Hi I wanted to open, read and close a file using following code: <?php $filename="test.txt"; $handle= fopen ($filename, "r"); $contents=fread($handle,filesize($filename)); fclose ($handle); ?> This file is located in the map: /users/sites/test.txt But opening the .php file on my local browser doesn't do a thing. I only get a blanc screen. I thought that file permission could be the problem, but I don't know what to change. Does anyone have any experience with this on Mac and how to solve it? Thanks already.
  6. I would like to develop a system that makes remote reading of the result of some search sites. These results are paginated and many sites use ajax to load pages. How can I accomplish this system with php? example of a site search page result: http://busca.submarino.com.br/busca.php?q=celular&sessao=4b712361eee996720660b5d6bde5dfc1f22066c9&idbusca=c9aeb969a4e7fb45bbbf152c85f1234cd768f5e7 As you can see at the bottom of the page, there is some javascript attached to the pagination link. Can anyone help with some idea? Thanks
  7. This is the first part of the search script and i was doing some debuging and i cant figure out why this code if( !($fd = fopen($url,"r")) ){ die( "Could not open URL!" ); } while( $buf = fgets($fd,1024) ) { /* Remove whitespace from beginning and end of string: */ $buf = trim($buf); /* Try to remove all HTML-tags: */ $buf = strip_tags($buf); $buf = preg_replace('/&\w;/', '', $buf); /* Extract all words matching the regexp from the current line: */ preg_match_all("/(\b[\w+]+\b)/",$buf,$words); print_r($words); } doubles each associate array like this Array ( [0] => Array ( ) [1] => Array ( ) ) Array ( [0] => Array ( [0] => It [1] = > was [2] => November ) [1] => Array ( [0] => It [1] = > was [2] => November ) ) When I would expect this Array ( [0] => Array ( ) ) Array ( [0] => Array ( [0] => It [1] = > was [2] => November ) )
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.