|
COMPARE PRICES: Digital
cameras, MP3
Players, Camcorders, Mobile phones,
PDA, Computers, Electronics LCD monitors,
Printers,
Notebook,
DVD Players,
Motherboards,
TV,
ipod,
Processors.
See all...
|
|
cURL libcurl PHP ExamplesPHP/CURL Examples Collection
We try to collect examples on how to program the PHP/CURL interface
here. If you have any source snippests you want to share with the rest of the
world, please let us know!
| Example | Description | Author |
| blogpost |
Post a blog entry to blogger.com using their "Atom" XML-based API.
| Michael Phipps |
| callbacks |
Set callback functions to receive the HTTP response as it comes through.
| Keyvan Minoukadeh |
| cookiejar |
Login to on one page and then get another page passing all cookies from the
first page along
| Mitchell |
| customrequest |
CURLOPT_CUSTOMREQUEST usage shown
| |
| ebay_login |
Mimics a browser and logs in to ebay
| Imran Khalid |
| ftpupload |
FTP upload to a remote site
| Daniel Stenberg |
| getbinarypageinvar |
Get the contents of a web page as a binary into a php variable. | |
| getpageinvar |
Get the contents of a remote web page into a PHP variable
| |
| linkchecker |
Check for a given link in a remote page
| Michael Phipps |
| multi |
Shows how to fetch several documents at once by using the multi interface
| Roman Rozanov |
| multipartpost |
Using a multipart/form-post file upload form on a web page.
| Pete James |
| put |
Perform a HTTP PUT to a remote site
| Julian Bond |
| resizejpg |
Download a remote image, resize it and show it to the user
| Michael Phipps |
| rss-adsense |
Follow your Adsense earnings with an RSS reader
| Ozh |
| simpleget |
Get a URL
| |
| simplepost |
Basic HTTP POST operation
| |
The ebay_login.php ExampleMimics a browser and logs in to ebay
Written by Imran Khalid
<?php
/*
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' File: ebay_login.php
'
' Description: This script Login you on Ebay.com website using curl in php.
'
' Written by: Imran Khalid imranlink@hotmail.com
'
' Languages: PHP + CURL
'
' Date Written: March 23, 2004
'
' Version: V.1.0
'
' Platform: Windows 2000 / IIS / Netscape 7.1
'
' Copyright: Open Sorce Code (GPL)
'
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
*/
// 1-Get First Login Page http://signin.ebay.com/aw-cgi/eBayISAPI.dll?SignIn
// This page will set some cookies and we will use them for Posting in Form data.
$ebay_user_id = "XXXX"; // Please set your Ebay ID
$ebay_user_password = "YYYYY"; // Please set your Ebay Password
$cookie_file_path = "crawler\ebay_login\cook"; // Please set your Cookie File path
$LOGINURL = "http://signin.ebay.com/aw-cgi/eBayISAPI.dll?SignIn";
$agent = "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$LOGINURL);
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
$result = curl_exec ($ch);
curl_close ($ch);
// 2- Post Login Data to Page http://signin.ebay.com/aw-cgi/eBayISAPI.dll
$LOGINURL = "http://signin.ebay.com/aw-cgi/eBayISAPI.dll";
$POSTFIELDS = 'MfcISAPICommand=SignInWelcome&siteid=0&co_partnerId=2&UsingSSL=0&ru=&pp=&pa1=&pa2=&pa3=&i1=-1&pageType=-1&userid='. $ebay_user_id .'&pass='. $ebay_user_password;
$reffer = "http://signin.ebay.com/aw-cgi/eBayISAPI.dll?SignIn";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$LOGINURL);
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$POSTFIELDS);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_REFERER, $reffer);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
$result = curl_exec ($ch);
curl_close ($ch);
print $result;
?>
|