WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
PHP Web Logs (BLogs)
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Submit Site
Forex Trading Online forex trading platform

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : CURL PHP (Screen Scraping) - How to get the content from external web sites using CURL (HTTP or HTTPS).
Categories : PHP, CURL Click here to Update Your Picture
Suraj Thapaliya
Date : Mar 16th 2007
Grade : 5 of 5 (graded 1 times)
Viewed : 10061
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Suraj Thapaliya
Action : Grade This Code Example
Tools : My Examples List

 
Like this code?
Show the author your appreciation.
Submit your own code examples 
 

You must enable CURL libraries on you system


CASE 1: Just retrieve the site content
<?php
$ch
= curl_init() or die(curl_error());
curl_setopt($ch, CURLOPT_URL,"http://search.msn.com/results.aspx?q=test&FORM=MSNH");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data1=curl_exec($ch) or die(curl_error());
echo
"<font color=black face=verdana size=3>".$data1."</font>";
echo
curl_error($ch);
curl_close($ch);
?>




CASE 2: Retreive the site content by posting the value from FORM for eg. contact form and other
<?php
$a
=$_POST["a"]; // Form posted value
$ch = curl_init() or die(curl_error());
$params="a=$a";
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$params);
curl_setopt($ch, CURLOPT_URL,"http://www.abc.com");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data1=curl_exec($ch) or die(curl_error());
echo
"<font color=black face=verdana size=3>".$data1."</font>";
echo
curl_error($ch);
curl_close($ch);
?>


CASE 3:        Retrieve date from HTTPS site
<?php
$a
=$_POST["a"];
$ch = curl_init() or die(curl_error());
$params="a=$a";
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$params);
curl_setopt($ch, CURLOPT_URL,"http://www.abc.com");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, 'username:password'); // IF required
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,0);
$data1=curl_exec($ch) or die(curl_error());
echo
"<font color=black face=verdana size=3>".$data1."</font>";
echo
curl_error($ch);
curl_close($ch);
?>



A function to check if a URL exists
Categories : PHP, CURL, HTTP
These PHP Classes Check if a host is alive using various methods.
Categories : PHP, PHP Classes, Sockets, CURL
Url To Pdf Report By Remote Application
Categories : PHP, PHP Classes, PDF, CURL
Using cURL to download a file programmatically.
Categories : PHP, PHP Extensions, CURL
Amazon.com API, CURL-REST Parser. Obtain data about Amazon products (PHP5 +)
Categories : PHP, Ecommerce, XML, Web Services, CURL
Open remote https url using Curl and accept cookie
Categories : PHP, CURL
Using data from a string.
Categories : PHP, Strings, CURL
curl_close -- Close a CURL session
Categories : PHP, PHP Functions, CURL
Import the yahoo address book.
Categories : PHP, CURL, Authentication
Yahoo! Messenger Friend List
Categories : PHP, CURL, HTML and PHP
Newbie Notes #8 - A cron trick
Categories : PHP, CURL, Beginner Guides
Link Manager for Link Exchangers
Categories : PHP, PHP Classes, Databases, MySQL, CURL
Sample AIM (Advanced Integration Method) PHP Script For Authorize.net using CURL
Categories : CURL, Ecommerce, PHP
PHP Youtube Downloader - This is a set of PHP functions that can be used to download movies from Youtube.com.
Categories : PHP, CURL, Regexps
Returns Yahoo! Address Book and Messenger List as an Array
Categories : PHP, PHP Classes, CURL