开发者

Problem with cURL in PHP

At work im having a big issue getting a cURL piece of our application to work on our live environment, but it works alright on our QA servers. The server environments are "supposed" to be the same.

cURL is executing, but the data is not being posted back. What i want to know is... is there something on the server that i could check to verify that curl is installed, running properly, etc? is there some config files I should look to see if data is not being posted back because of a certain setting?

I dont know how and what to begin looking at... or how to tackle this issue. Can someone make some suggestions?

curl is executing, but the data is not being posted back. What i want to know is... is there som开发者_如何学运维ething on the server that i could check to verify that curl is installed, running properly, etc? is there some config files I should look to see if data is not being posted back because of a certain setting?


if your server is *nix based, and you have CLI access to the server, try typing

php -i

and see if it spits out a ton of data about your configuration. to automatically seach for cURL, do this:

php -i | grep cURL

and see if anything shows up. if your server isn't *nix, you don't have access, or the command isn't found (it's not on the $PATH), I'd recommend the next way.

second way - save the following text as a file (for example phpinfo.php):

<?php phpinfo(); ?>

and put it somewhere on your production environment that nobody's going to go to (for the minute you leave it there). otherwise, if you're a security freak, let me know and I'll put some more code.

anyways, hit that file in a web browser (i.e. http:// production.server / secure_or_obscure_dir / phpinfo.php ), then delete the source file (while leaving the page open).

again, view this page for cURL or press CTRL + f, then type "cURL" (omit quotes).

if cURL is there, then it's installed, otherwise you have to install it.

if it's installed, you're probably not getting good data back. check the curl_errno or curl_error on the cURL object (for the last error).

additionally, you get more info on the object by doing this:

print_r( curl_getinfo( $theNameOfYourCURLObject ) );

to see if you're getting error HTTP statuses ( > 400 ).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜