Jump to content

Search the Community

Showing results for tags 'php fopen'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • 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

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 2 results

  1. Hi all. I have a php file that i need to read contents from. I can search for a string but i am stumped on how to start from a point and to end at a point Below is the payout of the file. I just want to return Paul1 plist1: plist1 plist2: plist2 plist3: plist3 plist4: plist4 and not the rest. quote_lost_reason "": "" Price: Price Product: Product Other: Other Paul1 plist1: plist1 plist2: plist2 plist3: plist3 plist4: plist4 Site Lighting Interior: Interior Exterior: Exterior credit credit_note: Credit Note here is my code so far $file = '/var/www/html/***/custom/include/language/lang.en_us.lists.php'; $searchfor = "Paul1"; $array = file($file); //print_r($array); header('Content-Type: text/plain'); $contents = file_get_contents($file); $pattern = preg_quote($searchfor, '/'); $pattern = "/^.*$pattern.*\$/m"; if(preg_match_all($pattern, $contents, $matches)){ echo "Found matches:\n"; echo implode("\n", $matches[0]); } else{ echo "No matches found"; }
  2. $("input.class_input_button_send").on("click",function(event) { event.preventDefault(); //var username = $("input.class_input_hidden").val(); var typed_text = $("input#id_input_text_type").val(); console.log(typed_text); rt = $.ajax({ type: "POST", url: "send.php", data: { name: "", typed_text: typed_text }, success: function(data) { console.log(data); console.log(data.length); } }).done(function() { alert( "success" ); }) .fail(function() { alert( "error" ); }); //console.log(rt); }); send.php =><?php <?php if( session_id() == '' ) { session_start(); } if($_SERVER['SERVER_PROTOCOL'] == "HTTP/1.1") { $domain_host_root = "http://" . $_SERVER['SERVER_NAME'] . "/"; } require_once 'core/model/mysql/mysqldb.php'; require_once 'core/utility/debug-app.php'; require_once 'core/utility/utility.php'; require_once 'core/view/view.php'; //$_POST['typed_text'] = "abc"; $typed_text = $_POST['typed_text']; $objDateTime = new DateTime('NOW'); $target_file = $objDateTime->format("Y-m-d"); $handle = fopen("archive/" . $target_file . ".txt", "w+"); fwrite($handle, $target_file_data); echo json_encode($target_file); ?> fopen function is working inside that send.php script if i run this as a standalone script, but fopen function returns null through the jquery $.ajax() function.
×
×
  • 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.