curl_init($url) returns Resource id #7

php

Solution

`curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);`

Where does the `$ch` come from, you use `$process` before, is the last line copied from other place?

The undefined variable will be null.

Problem

There is a CURL functionality that i'd been using to fetch image from a url and save it to m server, since COPY() was disabled from my hosting . the url i passed was $url=http://upload.wikimedia.org/wikipedia/commons/thumb/e/e8/People_from_Switzerland.png/285px-People_from_Switzerland.png ``` $headers[] = 'Accept: image/gif, image/x-bitmap, image/jpeg, image/pjpeg'; $headers[] = 'Connection: Keep-Alive'; $headers[] = 'Content-type: application/x-www-form-urlencoded;charset=UTF-8'; $userAgent = 'php'; $process = curl_init($url); curl_setopt($process, CURLOPT_HTTPHEADER, $headers); curl_setopt($process, CURLOPT_HEADER, 0); curl_setopt($process, CURLOPT_USERAGENT, $useragent); curl_setopt($process, CURLOPT_TIMEOUT, 30); curl_setopt($process, CURLOPT_RETURNTRANSFER, 1); curl_setopt($process, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); ``` And I get the following error when i tried to echo the curl_init($url) output process Resource id #7 Warning: curl_setopt() expects parameter 1 to be resource, null given in Warning: curl_errno() expects parameter 1 to be resource, null given in Please Help!

Original source