Page 1 of 1

having problem with curl

Posted: Mon Mar 05, 2007 1:07 am
by itsmani1
I am having problem with curl, here is my code i want to fetch content of this page on my page. From the page i just want to fetch the search box. but its not working.

i i try this it works fine and shows me output.

Code: Select all

curl_setopt($ch, CURLOPT_URL, "http://www.google.com.pk");
not in this case.

Code: Select all

header("Cache-control: private, no-cache");
	header("Expires: 0");
	header("Pragma: no-cache");
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_HEADER, 0);
	curl_setopt($ch, CURLOPT_URL, "https://www.kulula.com/Default.aspx");
	curl_setopt ($ch, CURLOPT_COOKIEJAR, "tmp.txt");
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	echo curl_exec($ch);	
	curl_close($ch);
Output:

Object moved to here.


any help.
thank you

Posted: Mon Mar 05, 2007 4:13 am
by volka
The site uses a browser switch and cannot identify cUrl as a "valid" client.
Add

Code: Select all

curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_MAXREDIRS, 4);
and take a look at the output.
You can change the agent-string, see http://de2.php.net/manual/en/function.curl-setopt.php

p.s.: make sure you have permissons to access the site in this way.

Posted: Mon Mar 05, 2007 4:47 am
by itsmani1
thanks i have done it and its working now,
permissions are available.