# need cURL help



## Solaris17 (Dec 14, 2010)

```
‎/*
Link validator

Will use cURL to attempt to visit a webpage, and then return based upon how the
request was handled. Used for embedded videos to validate the ID is existant.

expects a link url as string
returns an array of three elements:
return_array[0] = HTTP version
return_array[1] = Returned error number (200, 404, etc)
return_array[2] = Returned error text ("OK", "File Not Found", etc) */
function check_link($link) {
$main = array();
[COLOR="Red"]$ch = curl_init();[/COLOR]
curl_setopt ($ch, CURLOPT_URL, $link);
curl_setopt ($ch, CURLOPT_HEADER, 1);
curl_setopt ($ch, CURLOPT_NOBODY, 1);
//	curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($ch, CURLOPT_TIMEOUT, 10);
curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 

5.0)");
ob_start();
curl_exec ($ch);
$stuff = ob_get_contents();
ob_end_clean();
curl_close ($ch);
$parts = split("n",$stuff,2);
$main = split(" ",$parts[0],3);
return $main;
}
```

Error is

Fatal error: Call to undefined function curl_init() in C:\X\posts.php on line 198

WAT do? This is video embed code. When submiting I am given that error.


----------



## Easy Rhino (Dec 14, 2010)

look at line 198 on your posts.php file and see what it is


----------



## Solaris17 (Dec 14, 2010)

Easy Rhino said:


> look at line 198 on your posts.php file and see what it is



thats it. thats why im confused.


----------



## Easy Rhino (Dec 14, 2010)

so is this a php script using the curl module?


----------



## W1zzard (Dec 14, 2010)

http://www.php.net/manual/en/curl.requirements.php

did you install libcurl ? enabled it in the php config file? is php compiled with curl support?


----------



## Solaris17 (Dec 15, 2010)

thanks guys forgot to install curl man I feel retarded will get back with results.


----------



## Solaris17 (Dec 16, 2010)

worked thanks guys. installed cURL removed the ";" from curl.dll (in php.ini) and all is well in the forest.


----------

