You are here: --/ PHP

Hướng dẫn lấy tin tự động từ các website

Hệ thống này thường gọi là: crawler Link download mã nguồn ví dụ Ví dụ ở lấy chúng ta lấy tin từ trang vnexpress.net Các bước làm: Từ đường dẫn tới trang cần lấy: (vd: http://vnexpress.net/GL/Xa-hoi/), ta sẽ viết code để lấy nội dung của nó: Stream GetContent() { HttpWebRequest web = (HttpWebRequest)HttpWebRequest.Create(Url); WebResponse... 
Tags: , , ,

Dùng mod CURL

- Nếu bạn ko muốn bất kỳ ai thấy được link khi sử dụng giao thức GET, POST hoặc bạn muốn gọi ẩn một trang để thực thi một hành động mà ko cho ai biết. Bạn có thể sử dụng mod CURL là tốt nhất * Khai báo hàm : PHP Code: function curl($method = 'GET',$vars,$url,$fl = 0,$head = 0,$nobody = 0) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); if ($method == 'POST') { curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $vars); } curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1"); curl_setopt($ch, CURLOPT_FOLLOWLOCATION,$fl); curl_setopt($ch, CURLOPT_HEADER,$head); curl_setopt($ch, CURLOPT_NOBODY,$nobody); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); // curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie); //curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie); ob_start(); $result = curl_exec($ch); curl_close($ch); ob_end_clean(); return $result; } *... 
Tags: , ,

Cách Đọc nội dung 1 URL bằng cURL

Cách Đọc nội dung 1 URL bằng cURL Code: /* gets the data from a URL */ function get_data($url) { $ch = curl_init(); $timeout = 5; curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout); $data = curl_exec($ch); curl_close($ch); return $data; } Cách dùng Code: $returned_content = get_data('http://vinasupport.com'); thật... 
Tags: , ,

Reading and writing the XML DOM with PHP

Reading and writing Extensible Markup Language (XML) in PHP may seem a little frightening. In fact, XML and all its related technologies can be intimidating. However, reading and writing XML in PHP doesn’t have to be a daunting task. First, you need to learn a little about XML — what it is and what it’s used for. Then, you need to learn how to read and write XML in PHP, which... 

Export pdf file với font unicode.

PHP có hỗ trợ lib export pdf, nhưng lại gặp vấn đề bản quyền, hì, xài tạm mấy cái opensource cho đỡ tốn money ^_^. FPDF, cái này hoàn toàn có thể đáp ứng yêu cầu của bạn, ở đây đã hướng dẫn khá đầy đủ http://www.fpdf.org/ và có examples demo. Vấn đề còn lại đặt ra là hiển thị font chữ, khi demo các examples ở... 

Tổng hợp jQuery plugin hữu ích

Có thể nhiều người trong chúng ta đã sử dụng nhiều plugin rất hay của jQuery. Dưới đây tớ sẽ cung cấp một danh sách các plugins jquery rất được yêu thích của nhiều nhà phát triển sử dụng. Một số các bạn có thể đã dùng hoặc có thể là chưa bao giờ dùng đến. Bài viết này sẽ được cập nhật liên tục khi có... 

connect oracle bằng php

Đầu tiên để sài được php kết nối vào oracle tại localhost bạn phải làm các bước sau trước Trong file php.ini tìm và bỏ ; ở trước Trích: ;extension = php_oci8.dll ;extension = php_oracle.dll Để kết nối đến Oracle Sử dụng OCI Extension Module: PHP Code: <?php if ($c=OCILogon("scott", "tiger", "orcl")) { echo "Successfully connected to Oracle.n"; OCILogoff($c); } else { $err = OCIError(); echo "Oracle Connect Error " . $err[text]; } ?> Sử... 

WYSIWYG editors

List of external info on WYSIWYG editors WYSIWYG client-side HTML editors, working at least on IE & Moz+FF * With source (or customizable to another syntax) + open source # htmlarea http://dynarch.com/mishoo/htmlarea.epl (v3.0)(No longer supported) # kupu http://kupu.oscom.org/ (successor of Epoz) smile KupuContrib # fckeditor http://www.fckeditor.net/ # tinymce http://tinymce.moxiecode.com/ (works... 

CakePHP – Sử dụng css

To use cakephp’s framework to the fullest, you need to utilize its conventions. To modify the default template for your site copy: /cake/libs/view/templates/layouts/default.thtml to /app/views/layouts/ You then edit that copied file. The presence of /app/views/layouts/default.thtml tells cake to stop looking at the old layout and look at the new one. So you’d think that it would work the same... 

PHP và UNICODE UTF-8 trong MySQL 4.1.x – 5.0.x

PHP và UNICODE UTF-8 trong MySQL 4.1.x – 5.0.x ( Sử dụng phpMyAdmin 2.6.x) Khi chuyển database MySQL từ phiên bản 3.x lên 4.1 trở đi bạn sẽ gặp vấn đề với mã font Unicode, để khắc phục tình trạng này bạn có thể làm theo hướng dẫn sau: 1. Import database vào MySQL 4.1 – 5.0.x: Khi import file database là dạng mã unicode (File sql của... 

Hướng dẫn chèn xinha bộ soạn thảo trên web

Chào bạn, cài đặt Xinha trình tự như sau: 1/ Copy thư mục Xinha vào source. 2/ Copy file xinha/examples/XinhaConfig.js -> xinha/XinhaConfig.js 3/ Mở file XinhaConfig.js, dòng số 9, điền tên các textarea muốn hiển thị, cách nhau bởi dấu “,” vd: Code : xinha_editors=xinha_editors?xinha_editors:["myTextArea","anotherOne"]; 3/ Mở file... 

Mã hóa và giải mã

I/ Chú thích về mã hóa và giải mã: 1. Mã hóa (Encode): Chuyên được sử dụng để xây dựng các thuật toán nhằm đảm bảo tính cẩn mật, toàn vẹn, thẩm định… cho dữ liệu. Dựa trên một số kiểu bí mật, thông thường liên quan đến các khoá và một số hàm toán cụ thể (như hàm toán một-chiều). 2. Giải mã (Decode):... 

Sử dụng cookie tạo bộ đếm trang

<?php if (!isset($_COOKIE['visits'])) $_COOKIE['visits'] = 0; $visits = $_COOKIE['visits'] + 1; setcookie(‘visits’,$visits,time()+3600*24*365); ?> <html> <head> <title> Title </title> </head> <body> <?php if ($visits > 1) { echo(“This is visit number $visits.”); } else { // First visit echo(‘Welcome to my... 

Cookie Login Code

<?PHP IF( (ISSET($_COOKIE['USERNAME_COOKIE'])) && (ISSET($_COOKIE['PASSWORD_COOKIE'])) ) { $qry=MYSQL_QUERY("select * from loginTblName where username='".$_COOKIE['USERNAME_COOKIE']."' and password='".$_COOKIE['PASSWORD_COOKIE']."'") or DIE(MYSQL_ERROR()); IF(MYSQL_NUM_ROWS($qry)!=0){ $res=MYSQL_FETCH_ARRAY($qry); $_SESSION["ad_id"] ... 

Cách thức kiểm tra thông tin đăng nhập an toàn trong PHP

Thông thường khi viết một portal hay forum hay là một sản phẩm nào đó có chức năng đăng nhập dành cho thành viên thì đôi khi việc kiểm tra thông tin đăng nhập lại hết sức cần thiết. Nếu nói về những người dùng hợp lệ (tức là đăng nhập bằng chính tài khoản của họ) thì không phải bàn tới, tuy nhiên trong số đó... 
Copyright © 20010 ..::VN Support::...All Right Reserved.
Design by Junkie and developed by Manlivo.
Contact:
  • sugiatinhyeu_thantinhyeu3
  • manlivo
  • manlivo@gmail.com
Powered by WordPress.
  • frontpage hit counter
  • Page Ranking Tool