PDA

View Full Version : I can't read this site with CURL, why?!


ConfusedOfLife
08-14-2004, 07:16 PM
Hi

I'm trying to read the contents of these sites with CURL but I'm not successful:

www.iranphp.net
www.yahoo.com
www.codingforums.com

The code I'm using is something like this:


$ch = curl_init("http://www.iranphp.net");


curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch, CURLOPT_REFERER, "http://www.yahoo.com");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$data = curl_exec($ch);

curl_close($ch);

print $data;


I think they understand somehow that I'm not getting their content by means of a web browser and they block me. How can I get these sites contents? I was mainly trying to work with e-gold and do its automation service, but it said that I can't work with HTTPS because they're not installed on my system. I'm using PHP5 in Windows XP and I don't know how to install HTTPS support, there was nothing like that in php.ini

BTW I don't have this problem with sites like this:

www.baran.ir
www.alachigh.org

These sites are mine! And I knew that I didn't put any prevention method from curl. So, they work, but what about the real sites?!

Is there any tutorial or something that I can learn from? I think my knowlege in working with CURL is too limited.

Thank You

PS: BTW I learned whatever I know (I think that I know!) from this tutorial:

http://www.phpfreaks.com/tutorials/49/0.php

carl_mcdade
08-15-2004, 10:00 AM
They are not blocking you. It is just that using cURL is difficult and takes time to learn. Each site you connect to has certain things that need to be satisfied especially sites that use multiple servers and have javascript controls. See this thread for more info.

http://www.codingforums.com/showthread.php?t=42766

ConfusedOfLife
08-15-2004, 06:34 PM
Isn't there any sort of online tutorial or something that I can learn it step by step? Any special book? It should be something!

carl_mcdade
08-15-2004, 06:45 PM
I have been trying to find some stuff but have not seen anything. I am acquiring a list of things in PHP that are bad,old or have no documentation at all. cURL is one of these.

1.cURL
2.GD images
3.Zend engine extensions

ConfusedOfLife
08-15-2004, 06:54 PM
hmmmmmmm! d*mn! I should write this for e-gold, I mean I should write an automation script to work with e-gold and if cURL doesn't work, then I'm doomed!

Hey, cURL gives me an error that I don't have HTTPS installed, do you know how I can install HTTPS?

Thank You

carl_mcdade
08-15-2004, 10:08 PM
You have to install OpenSSL (http://www.openssl.org/) or have it on your web hosts server.