| @@ 512-527 (lines=16) @@ | ||
| 509 | * @param $url |
|
| 510 | * @return bool|mixed |
|
| 511 | */ |
|
| 512 | public static function planetFetchCURL($url) |
|
| 513 | { |
|
| 514 | if (!function_exists('curl_init')) { |
|
| 515 | return false; |
|
| 516 | } |
|
| 517 | $ch = curl_init(); // initialize curl handle |
|
| 518 | curl_setopt($ch, CURLOPT_URL, $url); // set url to post to |
|
| 519 | curl_setopt($ch, CURLOPT_FAILONERROR, 1); |
|
| 520 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects |
|
| 521 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return into a variable |
|
| 522 | curl_setopt($ch, CURLOPT_TIMEOUT, 30); // times out after 31s |
|
| 523 | $data = curl_exec($ch); // run the whole process |
|
| 524 | curl_close($ch); |
|
| 525 | ||
| 526 | return $data; |
|
| 527 | } |
|
| 528 | ||
| 529 | /** |
|
| 530 | * @param $url |
|
| @@ 501-516 (lines=16) @@ | ||
| 498 | * @param $url |
|
| 499 | * @return bool|mixed |
|
| 500 | */ |
|
| 501 | function planet_fetch_CURL($url) |
|
| 502 | { |
|
| 503 | if (!function_exists('curl_init')) { |
|
| 504 | return false; |
|
| 505 | } |
|
| 506 | $ch = curl_init(); // initialize curl handle |
|
| 507 | curl_setopt($ch, CURLOPT_URL, $url); // set url to post to |
|
| 508 | curl_setopt($ch, CURLOPT_FAILONERROR, 1); |
|
| 509 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects |
|
| 510 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return into a variable |
|
| 511 | curl_setopt($ch, CURLOPT_TIMEOUT, 30); // times out after 31s |
|
| 512 | $data = curl_exec($ch); // run the whole process |
|
| 513 | curl_close($ch); |
|
| 514 | ||
| 515 | return $data; |
|
| 516 | } |
|
| 517 | ||
| 518 | /** |
|
| 519 | * @param $url |
|