Phpcurl_exec () uses the following code to write a program to throw xml documents and send URLs.
$ Ch = curl_init ();
Curl_setopt ($ ch, CURLOPT_URL, "http: //". $ this-> IP. $ this-> URL );
Curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, true );
Curl_setopt ($ ch, CURLOPT_POST, 1 );
Curl_setopt ($ ch, CURLOPT_POSTFIELDS, $ this-> PARAMETER );
$ Ret = curl_exec ($ ch );
Curl_close ($ ch );
All the parameters in this code are correct.
But curl_exec () returns false.
I checked baidu and said that the extension = php_curl.dll dynamic library should be enabled.
----
Is this dynamic library available only in windows. My company's environment is php 5.3.5, linux environment, I checked the company's php. ini does not have this option.
How can I use this function in linux. How to configure php. ino
Reply to discussion (solution)
Install php extension curl in linux
You need to compile it. For more information about the method, visit the Internet.
Phpinfo (); check whether curl is enabled.
. Dll is a windows dynamic link library.
In linux, the. so extension is required.
Search, a lot of tutorials
Curl_exec () returns false.
The connection "http: //". $ this-> IP. $ this-> URL failed.
Check whether the url is actually available.
If the curl extension is not loaded, the function is undefined.
How can I check whether curl is available in linux?
$ Ch = curl_init ();
No error
Echo $ ch;
Output Resource id #...
Curl is available.
Professional
If (! Function_exists ('curl _ init ') die 'curl unavailable ';
I see the curl. so file in the company. The path is/usr/lib64/php/modules/curl. so.
I added extension =/usr/lib64/php/modules/curl. so to php. ini. Is it correct?
-- Test. Still unsuccessful
"Http: //". $ this-> IP. $ this-> URL );
Print the address.
Is this address valid?
$ Ch = curl_init (); curl_setopt ($ ch, CURLOPT_URL, "http ://". $ this-> IP. $ this-> URL); curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, true); curl_setopt ($ ch, CURLOPT_POST, 1); curl_setopt ($ ch, CURLOPT_POSTFIELDS, $ this-> PARAMETER); $ ret = curl_exec ($ ch); // check for errors if (curl_errno ($ ch) {echo 'curl error :'. curl_error ($ ch);} curl_close ($ ch );
See what is prompted.
First, you should start with several questions:
1) Check whether curl extension is enabled. #7
2) is the curl url correct?
The curl. so file has been configured. The reason is that this server has not set the connection to the internet. thank you. Already called