standard.net.curl.curl_strnequal

curl_strnequal is available since version 1.0.

Prototype:

number curl_strnequal(string str1, string str2, number len)

Parameters

str1
the first string
str2
the second string
len
the number of characters to compare

Description:

Case insensitive string comparisons of N characters.


Similar to curl_strequal, except it only compares the first len characters of str1.

Return value:

Non-zero if the strings are identical. Zero if they're not.

Example
import standard.net.curl
import standard.C.io


class Main {
	var data="";
	var header="";

	function write_data(ptr, size, nmemb, stream) {
		//echo "Stream: $stream\n";
		if (stream==1001) 
			header+=ptr;
		else
			data+=ptr;
		return size*nmemb;
	}

	function read_data(var ptr, size, nmemb, stream) {
		echo typeof ptr;

		for (var i=0;i<100;i++)
			ptr+="x";

		return size*nmemb;
	}

	function progress(clientp, dltotal, dlnow, ultotal, ulnow) {
		echo "$dlnow/$dltotal bytes received      \r";
	}

	function Main() {
		curl_global_init(CURL_GLOBAL_ALL);

		var curl_handle=curl_easy_init();

		curl_easy_setopt(curl_handle, CURLOPT_PROGRESSFUNCTION, progress);
		curl_easy_setopt(curl_handle, CURLOPT_NOPROGRESS, 0);


		curl_easy_setopt(curl_handle, CURLOPT_URL, "http://curl.haxx.se");

		curl_easy_setopt(curl_handle, CURLOPT_READFUNCTION, read_data);

		curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, write_data);
		curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, 1002);
		curl_easy_setopt(curl_handle, CURLOPT_WRITEHEADER , 1001);


		curl_easy_perform(curl_handle);
		echo "\n\n";
		curl_easy_getinfo(curl_handle, CURLINFO_SSL_ENGINES, var arr);
		echo arr;

		curl_easy_cleanup(curl_handle);

		WriteFile(data,"data.html");
		WriteFile(header,"data_header.txt");

	}
}