13 Aug, 2010

Php file_get_contents

Articles related to php file_get_contents

PHP file_get_contents giving garbled output

http://digitalpbk.com/php/file_get_contents-garbled-gzip-encoding-website-scraping PHP file_get_contents giving garbled output Are you getting garbled values when using file_get_contents fetching an external URL (website scrapping using php) and wondering what went wrong ? The content is appearing to have wierd characters instead of normal HTML output because of GZIP output encoding by the website you are fetching. You can fix this issue in multiple ways. Method 1 : Accept-Encoding In this method we set the request headers so that the webserver is forced to respond ...
Published 2 years, 2 months ago

Using PHP for more than HTML

http://digitalpbk.blogspot.com/2007/04/using-php-for-more-than-html.html imagesheader("Content-Type: image/jpeg");echo file_get_contents("../images/some.jpg");?>The above code returns a jpeg. But this is static everytime we see the some.jpg. The advantage of using php to return image is that you can provide a authentication validation, i.e, the user must have signed in to view the image. Thus automatically hot linking is prevented. (Hot linking is the use of images of other servers, by another server. for eg an image on www.example.com displyed on www ...
Published 5 years, 1 month ago

cURL PHP Error on Windows

http://digitalpbk.blogspot.com/2009/05/curl-php-windows-unable-load-libcurlphp.html cURL PHP Error on Windows Fatal error: Call to undefined function curl_init() in D:/webs/php.php on line 284This problem arises because of not including the lib_curl.dll to PHP. To solve this uncomment the line as shown below;extension=php_bz2.dllextension=php_curl.dll;extension=php_dba.dllNow restart apache server. If you get an error "Unable to Load X:/path/php/ext/php_curl.dll", copy SSLEAY32.PHPlibEAY32.dll (OpenSSL) Libraries to the System32 folder.Now restart apache server ...
Published 3 years ago

Custom extenstion for a Server Script

http://digitalpbk.blogspot.com/2007/05/custom-extenstion-for-server-script.html Custom extenstion for a Server Script IntroPHP files have a ".PHP" extension and is by default the extension used to run php scripts. Thats ordinary. Now it would be cool if we could name another extension (say .do or .html) for a PHP script and get the same output. This is precisely what the following is about.In order to map a particular extension to a particular application, apache uses handlers. Basically you can define an extension and add the corresponding handler. This can ...
Published 4 years, 12 months ago

Setting up Apache-PHP on windows.

http://digitalpbk.blogspot.com/2006/12/setting-up-apache-php-on-windows.html Setting up Apache-PHP on windows. Step 1 : Downloading required files. apache server binaries : httpd.apache.orgphp binaries : www.php.netStep 2 : Install apache server. Installing apache server is pretty much simple, and same as any other installation. Just enter a network domain name and server name and some email id (someone@microsoft.com). Then choose a installation directory : for reference i am using "C:\". Note that a directory called apache2 will be created under C:\ .So ...
Published 5 years, 4 months ago

Solve "Cannot modify header information - headers already sent by *.php"

http://digitalpbk.com/php/warning-cannot-modify-header-information-headers-already-sent Solve  "Cannot modify header information - headers already sent by *.php" Solve "Cannot modify header information - headers already sent by *.php" Warning: Cannot modify header information - headers already sent by somefile.php (output started at somefile.php:###) in somefile.php on line ### This Warning is shown by PHP when you use the header function to output headers or use the setcookie function to set cookies after any echo or content which is not inside PHP tag. Hello World !!! Both should throw this warning. You can disable ...
Published 2 years, 2 months ago

An Introduction to PHP

http://digitalpbk.blogspot.com/2007/04/introduction-to-php-part1.html An Introduction to PHP PHP ?PHP stands for Hypertext Preprocessor. Well what is it ? In the world wide web we are familiar with the HTML page. The HTML page is static and does not change. What if we want a page that has some parts common and other parts different according to the browser or user that is visiting the site? Say for an example, a user's profile page. It is wasteful and time consuming to make each user a separate HTML page. Here is where Server side scripting comes in. Thus we ...
Published 5 years, 1 month ago

Removing index.php From URL in CodeIgniter

http://digitalpbk.com/code-ignitor/removing-indexphp-url Removing index.php From URL in CodeIgniter In Code Ignitor by default all URLs except the default home contains "index.php" by default in the URL, For example http://localhost/index.php/class/function. In order to make the URLs "cleaner", we have to remove "index.php" from the URL. This is done using the mod_rewrite module in apache to redirect all traffic to index.php/. The following code inside .htaccess does the redirection. Code Igniter .htaccess Rules ...
Published 2 years, 2 months ago

Timezone: PHP, Shell and Crontab

http://digitalpbk.blogspot.com/2009/05/crontab-server-timezone-php-date.html Timezone: PHP, Shell and Crontab Programming in different timezones can be a headache if not taken care off initially. Codes written to work in one time zone can go wrong when ported to a server that runs on another Timezone. There a few things to take care off when you change from server to server.PHPBy default PHP uses the Timezone that is set in the server or php.ini configuration files. Inorder to make a robust php code that can work in any server environment, it is always a good practice ...
Published 2 years, 12 months ago

Fix for Facebook authentication on IE

http://digitalpbk.blogspot.com/2009/08/facebook-auth-next-parameter-ie.html Fix for Facebook authentication on IE What?This is for Facebook developers who have faced this problem. If you are using an Facebook application to authenticate a user on a PHP website, the Facebook redirection on Internet Explorer specifically fails the login of the user. This is because the return URL returned by facebook specifically for IE is the appending of the CallBack URL specified in the Application +the Next parameter + a "?" + the auth_token parameter.This results ...
Published 2 years, 9 months ago

Related help topics for php file_get_contents More keywords like php file_get_contents
More pages for php file_get_contents


Email Newsletter
Email:
Popular Posts
Recent Posts
Tags
Random photo
A Crab Hole A Crab Hole in Havelock Island Andaman
On Facebook
Recent Comments


digitalpbk