CURL and SSL
am 09.08.2007 14:42:39 von Knikola
Hi, all.
I need to screen scrap a page using CURL. I've been trying for hours the
access it, but I can't bypass its SSL protocl.
This is the code I've been using
private function ucitaj($url)
{
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; U;
Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt ($ch,CURLOPT_RETURNTRANSFER,1);
$result = curl_exec ($ch);
curl_close ($ch);
return new SimpleXMLElement($result);
}
This is the page it try to grab:
https://konet.kovanica.hr/tecajna?datum=01.08.2007&format=XM L&akcija=tecajna_ispis&as_attachment=0
I tried googling for a solution, but i failed miserably. I don't know
what i+m doing wrong , and what I need to do to solve it.
Any help is really Appriciated
Nikola Stjelja
Re: CURL and SSL
am 09.08.2007 20:47:23 von Andy Hassall
On Thu, 09 Aug 2007 14:42:39 +0200, Knikola wrote:
>I need to screen scrap a page using CURL. I've been trying for hours the
>access it, but I can't bypass its SSL protocl.
>
>This is the code I've been using
>
>private function ucitaj($url)
> {
>
> $ch = curl_init();
> curl_setopt ($ch, CURLOPT_URL, $url);
> curl_setopt ($ch, CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; U;
>Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0');
> curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
> curl_setopt ($ch,CURLOPT_RETURNTRANSFER,1);
> $result = curl_exec ($ch);
> curl_close ($ch);
>
> return new SimpleXMLElement($result);
> }
>
>This is the page it try to grab:
>https://konet.kovanica.hr/tecajna?datum=01.08.2007&format=X ML&akcija=tecajna_ispis&as_attachment=0
>
>I tried googling for a solution, but i failed miserably. I don't know
>what i+m doing wrong , and what I need to do to solve it.
Works for me. What error do you get? (use curl_error() if the error is at that
point).
--
Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Re: CURL and SSL
am 10.08.2007 07:53:07 von Knikola
Andy Hassall wrote:
> On Thu, 09 Aug 2007 14:42:39 +0200, Knikola wrote:
>
>> I need to screen scrap a page using CURL. I've been trying for hours the
>> access it, but I can't bypass its SSL protocl.
>>
>> This is the code I've been using
>>
>> private function ucitaj($url)
>> {
>>
>> $ch = curl_init();
>> curl_setopt ($ch, CURLOPT_URL, $url);
>> curl_setopt ($ch, CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; U;
>> Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0');
>> curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
>> curl_setopt ($ch,CURLOPT_RETURNTRANSFER,1);
>> $result = curl_exec ($ch);
>> curl_close ($ch);
>>
>> return new SimpleXMLElement($result);
>> }
>>
>> This is the page it try to grab:
>> https://konet.kovanica.hr/tecajna?datum=01.08.2007&format=XM L&akcija=tecajna_ispis&as_attachment=0
>>
>> I tried googling for a solution, but i failed miserably. I don't know
>> what i+m doing wrong , and what I need to do to solve it.
>
> Works for me. What error do you get? (use curl_error() if the error is at that
> point).
I feel like an idiot. It works, I feel so stupid. That's what happens
when you are overworked, underpaid and something nasty bit you on your
stomach..
Thany Andy for your trobles
Cheers
Nikola Stjelja