Page 1 of 1
cURL
Posted: Thu Nov 16, 2006 4:18 pm
by ol4pr0
Now ihave been a bit busy with the cUrl.
Nice got almost everything to work.
However what i am confused about is the following
curl opens a page (any page)
page executes whatever it needs to execute
and returns a var or whatever.
curl page receives this return
Now that return and receiving that return is what i am missing. How to do that

Posted: Thu Nov 16, 2006 4:23 pm
by feyd
Tell cURL you want the return data?
curl_setopt() has the option.
Posted: Thu Nov 16, 2006 4:23 pm
by Burrito
Code: Select all
$result = curl_exec($ch);
echo $result;
Posted: Thu Nov 16, 2006 4:27 pm
by ol4pr0
Thanks ill try..
thing is dont have i-net at home.. yea i know 3th world <span style='color:blue' title='I'm naughty, are you naughty?'>smurf</span>..
so trying to figure out as much as i can howeve get stuck sometimes
Posted: Thu Nov 16, 2006 4:30 pm
by feyd
Download the manual to a thumb-drive or CD and bring it home.
http://php.net/download-docs.php
:)
Posted: Fri Nov 17, 2006 2:25 pm
by ol4pr0
jeje. funny guy, do you have any idaea how long it takes me loading up this page.
takes me about 3 minuuts i think. imagen wat a 2mb docs wil do.. takes me sometime and about 10 $USD.
Anyway.
i was messing with the $result = and some other options.
But i keep on getting 1 as return even when i put in a fake url
A short example ?
Posted: Fri Nov 17, 2006 2:35 pm
by feyd
CURLOPT_RETURNTRANSFER
details are just about
this link.
Posted: Fri Nov 17, 2006 2:40 pm
by ol4pr0
i believe that i did do that
now i dont have the code with me but it goes simplified like this
$c = curl_init(url)
curl_setopt($c,RETURNTRANSFER,1)
curl_exec($c)
curl_close($c)
Now while tryihng this it didnt reallymather where i put the $result everything echoes 1
Posted: Fri Nov 17, 2006 2:54 pm
by John Cartwright
curl_exec will return the output
Posted: Wed Nov 22, 2006 3:06 pm
by ol4pr0
Ok just want to make sure.. here
the page retrieved by cURL.
when i echo something out it does return. but when i use return 1; for example it doesnt return anything.
is this correct or am i doing something wrong here.
Other thing
If i would use like define variables on the other end. would these be accesable when somebody uses cURL to fetch a page from my website for example.
Posted: Wed Nov 22, 2006 3:59 pm
by John Cartwright
ol4pr0 wrote:when i echo something out it does return. but when i use return 1; for example it doesnt return anything.
is this correct or am i doing something wrong here.
Code: Select all
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($ch);
If CURLOPT_RETURNTRANSFER is set to 1, then it will return it's value ($data will contain the result). If it is not set then it will be outputted.
ol4pr0 wrote:
Other thing
If i would use like define variables on the other end. would these be accesable when somebody uses cURL to fetch a page from my website for example.
No, only the html output.