Archive: php
-
Sep 02, 2011
Comments OffHow to Build Web Apps Faster in cakephp?
The pressure is on. You’ve got limited time, and you need a system to catalogue your extensive movie collection in 15 minutes. Who ya gonna call? CakePHP of course! CakePHP is a rapid application development framework that covers all the common tasks required to get a web application up and running. Handling all the repetitive...
-
Sep 02, 2011
Comments OffBuild a file sharing application in cakephp
The honeymoon is over baby. Now it’s time for the real work to begin. This iteration of our CakePHP tutorial series will result in your very own file-sharing tool. This is handy in the situation that you have a file you need to send to a business partner or client, or share with a friend,...
-
Sep 02, 2011
Comments Offhow to Build a bookmark site in cakephp?
If you’ve followed our last few tutorials, you’ll be a CakePHP expert by now: you know how to navigate controllers, delve into the depths of models and create views that astound your viewers. But having a taste of the sweet rapid development that CakePHP offers you, you want more, and you want to do more...
-
Sep 02, 2011
Comments OffHow to optimize php code.
In this post we are going to learn how to optimize our php code. once you optimize your php code then your applicationa and website will be very fast this will make quality code. Hi php programmer don’t forget these rules if you want to be good in php and want to work in MNC...
-
Aug 29, 2011
Comments OffWhat Is the Difference Between Mysql_Connect() and Mysql_Pconnect()?
When they are using mysql_connect() function, every time it is opening and closing the database connection, depending on the request . mysql_connect() and mysql_pconnect() both are working for database connection but with small difference. In mysql_pconnect(), ‘p’ stands for persistence connection. But in case of mysql_pconnect() function, first, when connecting, the function would try to...
-
Aug 29, 2011
Comments OffCURL URLS with a get variable
I had the following experience when harvesting urls with a get variable from a page using cUrl. HTML pages will output ampersands as & when the page is read by the curl function. If you code a script to find all hyperlinks, it will use & instead of &, especially using a regular expression search....
-
Aug 29, 2011
Comments OffCURL PHP wrapper for https results
If you want to write a sort of php wrapper to include the results of another http(s) request maybe pointing to a totally different site or just different code (mod_perl with HTML::Mason, in my case) into a php based layout, and just pass-thru all GET and POST variables to the sub-request, the following snippet can...
-
Aug 29, 2011
Comments OffCURL PHP: Get information regarding a specific transfercurl_getinfo — Get information regarding a specific transfer – curl_getinfo()
<?php // Create a curl handle $ch = curl_init('http://www.yahoo.com/'); // Execute curl_exec($ch); // Check if any error occured if(!curl_errno($ch)) { $info = curl_getinfo($ch); echo 'Took ' . $info['total_time'] . ' seconds to send a request to ' . $info['url']; } // Close handle curl_close($ch);...
-
Aug 29, 2011
Comments OffExample: Download Website / Webpage Trough CURL PHP
You can access / display any webpage through the following code: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44...
-
Aug 29, 2011
Comments OffCURL PHP: Email this page to a friend
Using curl to take snapshots of the current page for emailing the HTML is a clever little idea. (ie: Email this page to a friend) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 <?php //to be explained below! session_write_close(); $pageurl = "http://www.site.com/content.php?PHPSESSID=123XYZ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);...
-
Aug 29, 2011
Comments OffcURL to submit to an ASP/ASPX page
For anyone trying to use cURL to submit to an ASP/ASPX page that uses an image as the submit button. Make sure that you have ‘button_name.x’ and ‘button_name.y’ in the post fields. PHP names these fields ‘button_name_x’ and ‘button_name_y’, while ASP uses a dot. Also, as noted above, be sure to include the ‘__VIEWSTATE’ input...
-
Aug 29, 2011
Comments OffCURL PHP : Trouble on server 2003, IIS 6 php_curl
run (as an administrator) php.exe -i > C:\phpinfo.txt and go open C:\phpinfo.txt, look in the file to see if CURL was loading, if it’s there then keep reading. - running inside a text.php script on my IIS server would not show CURL loading - A permissions problem on libeay32.dll and ssleay32.dll was causing the cli...
-
Aug 29, 2011
Comments OffHow to use path for the cookies in CURL PHP LIBRARY ?
<?php $ch = curl_init() ; $myfile = "d:\\mydir\\second_dir\\cookiefile.txt" ; curl_setopt($ch, CURLOPT_COOKIEJAR, $myfile) ;...
-
Aug 29, 2011
Comments OffStop CURL to send messages to the SERVER error log
In order to prevent curl sending messages to the server error log, you need to instruct curl to use a temporary file for output on stderr. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29...
-
Aug 29, 2011
Comments OffA simple whois/domain availability check using cURL PHP
CURL Register Your domain but check its availability: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 <?php echo check_domain('www.imjan.com'); // Instant Example of using check_domain() function function check_domain($domain) { $data = 'http://'.$domain;...
-
Aug 29, 2011
Comments OffUsing PHP cURL to read and write RSS feed XML
Simple Example to read RSS feed and write in you local system. 1 2 3 4 5 6 7 8 9 10 11 <?php $ch = curl_init("http://feeds.feedburner.com/bagesh-blog"); // Change the RSS FEED URL $fp = fopen("file.txt", "w"); // Change Filename if you want curl_setopt($ch, CURLOPT_FILE, $fp); curl_setopt($ch, CURLOPT_HEADER, 0); curl_exec($ch); curl_close($ch); fclose($fp);...
-
Aug 29, 2011
Comments OffDisadvantage of cURL Library PHP example
Although it has been noted that cURL outperforms both file_get_contents and fopen when it comes to getting a file over a HTTP link, the disadvantage of cURL is that it has no way of only reading a part of a page at a time. For example, the following code is likely to generate a memory...
-
Aug 29, 2011
Comments OffTo follow ALL redirects using CURL brings up a lot of special cases
To follow ALL redirects using CURL brings up a lot of special cases. Here’s a function that takes everything into account (even javascript redirects) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31...
-
Aug 29, 2011
Comments OffFatal Error: Call to Undefined Function Curl_init() in E:\wamp\www\mytest\index.php on Line 10
If you see this error then you have not installed / enabled CURL Library. It’s very simple to install it. Just go to your php.ini and 1 2 3 ;extension=php_curl.dll // default setting in php.ini extension=php_curl.dll // Remove semicolon(;) and then restart you...
-
Aug 29, 2011
Comments OffWhat Are the Advantages of CURL Library?
PHP supports libcurl is a library that allows you to connect and communicate to many different types of servers with many different types of protocols. LIBCURL (CURL LIBRARY PHP) currently supports the http, https, ftp, gopher, telnet, dict, file, and ldap protocols. LIBCURL (CURL LIBRARY PHP) also supports HTTPS certificates, HTTP POST, HTTP PUT, FTP...