curl problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rainox
Forum Newbie
Posts: 1
Joined: Fri Mar 19, 2010 2:51 pm

curl problem

Post by rainox »

I studied curl function and I tried to write a code, but it doesn't work.

example :

Code: Select all

<?php
 
 
$ch = curl_init('http://www.example.co.il/login');
 
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, 'name=rainox&pass=123456');
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
 
curl_exec($ch);
 
curl_close($ch);
 
?>
 
Why doesn't it work?
Where is the problem?
User avatar
Darhazer
DevNet Resident
Posts: 1011
Joined: Thu May 14, 2009 3:00 pm
Location: HellCity, Bulgaria

Re: curl problem

Post by Darhazer »

What exactly doesn't work. What is the expected output (there is no output in the code btw)?
So, if you want someone to help you, please write down what you are expecting and what is the real result.
Post Reply