Main Menu

HOME

.Net
ASP
Assembly
C
C++
Delphi
HTML
Java
JavaScript
MySQL
PC interface
Powershell
Perl
PHP
VBScript
Visual Basic
XML

US Job listings




   Misc

   Amazon

   Links

PHP and cURL basic examples

 

OK we will show 2 basic examples, the first grabs a page of this site we have created and the second will grap google's homepage.

A word of warning do not use this in the second format unless you have permission from the website owner , the way I see this working is if you had several sites and perhaps wanted to display content from one of them in another.


 

 

Example1

<?php
$ch = curl_init("http://www.programmershelp.co.uk/curltest.php");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
curl_close($ch);
?>

see it in action here

Example2

<?php
//the site or URL to get
$ch = curl_init("http://www.google.com/");
//set the options for the transfer
curl_setopt($ch, CURLOPT_HEADER, 0);
//execute the session
curl_exec($ch);
//free up system resources !!IMPORTANT
curl_close($ch);
?>

see it in action here


 




   Sponsors
 

   Software
500 Java Tips E-book
PHP editor
PERL editor
Beginning Java
Beginning Visual Basic
Learn VB.net
Learn VB 6
VB and databases
ASP image library
C++ builder programming
C++ fundamentals

   Source Code
border styles(CSS)
number of entries in a log file(VBScript)
Winmm example(VB)
Degrees / Radians conversions(PHP)
Display an Access database(PHP)
disable CTRL + ALT + DEL on Windows XP(VB)
Operating System displayed in an excel table(VBScript)
clipboard examples(vb)




Copyright © 2004 by programmershelp.co.uk