Forum Moderators: coopster

Message Too Old, No Replies

HTTP requests

         

eatspinach

1:49 pm on Mar 10, 2010 (gmt 0)

10+ Year Member



Hello i need some help posting sending some xml to a url,
the xml is
<xml><command name="new"/><Name>campaign name</Name><Customer>customer name</Customer></xml>


i am currently using this,


$r = new HttpRequest('www.myurl.com',HttpRequest::METH_POST);



$r->addPostFields($xmlData);




try
{
echo $r->send()->getBody();
}
catch (HttpException $ex)
{
echo $ex;
}


but that's not working, any ideas?

sorry i am very new to this area of php.
thanks in advance

Anyango

2:16 pm on Mar 10, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



have a look at cURL library, you can search for cURL xml posting. Its an easy task using cUrl

eatspinach

2:30 pm on Mar 10, 2010 (gmt 0)

10+ Year Member



Its funny you should say that because right after i posted this i tried it the cUrl way and it worked first time.

using this code,

 $curlObject = curl_init();

//Sets an option on the given cURL session handle

curl_setopt($curlObject, CURLOPT_URL, "http://myurl.com");

//do not get the Header
curl_setopt ($curlObject, CURLOPT_HEADER, false);
// get the response as a string from curl_exec(), rather than echoing it
curl_setopt ($curlObject, CURLOPT_RETURNTRANSFER, true);

curl_setopt ($curlObject, CURLOPT_POST, true);
curl_setopt ($curlObject, CURLOPT_POSTFIELDS, "$xmlData");


$response = curl_exec($curlObject);

curl_close ($curlObject);



so now i have it working fine locally but when i try to run it on the server i am back to this problem.

[10-Mar-2010 14:27:17] PHP Warning: PHP Startup: Unable to load dynamic library 'C:\php\ext\php_curl.dll' - The operating system cannot run %1.
in Unknown on line 0


The joys of programming :(

Anyango

2:33 pm on Mar 10, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Server PHP doesnt have curl enabled/running properly. Do you have a windows server or Linux?

eelixduppy

2:33 pm on Mar 10, 2010 (gmt 0)



Looks like you don't have the extension properly installed or enabled. Take a look to see if that .dll exists, and also check to see if the curl extension is not commented out of the php.ini file.

eatspinach

2:45 pm on Mar 10, 2010 (gmt 0)

10+ Year Member



windows server, i have tried everything.

my extensions are as follows,


;extension=php_bz2.dll
extension=php_curl.dll
;extension=php_dba.dll
;extension=php_dbase.dll
;extension=php_exif.dll
;extension=php_fdf.dll
;extension=php_gd2.dll
;extension=php_gettext.dll
;extension=php_gmp.dll
;extension=php_ifx.dll
;extension=php_imap.dll
;extension=php_interbase.dll
;extension=php_ldap.dll
;extension=php_mbstring.dll
;extension=php_mcrypt.dll
;extension=php_mhash.dll
;extension=php_mime_magic.dll
;extension=php_ming.dll
;extension=php_msql.dll
;extension=php_mssql.dll
extension=php_mysql.dll
extension=php_mysqli.dll
;extension=php_oci8.dll
;extension=php_openssl.dll
;extension=php_pdo.dll
;extension=php_pdo_firebird.dll
;extension=php_pdo_mssql.dll
;extension=php_pdo_mysql.dll
;extension=php_pdo_oci.dll
;extension=php_pdo_oci8.dll
;extension=php_pdo_odbc.dll
;extension=php_pdo_pgsql.dll
;extension=php_pdo_sqlite.dll
;extension=php_pgsql.dll
;extension=php_pspell.dll
;extension=php_shmop.dll
;extension=php_snmp.dll
;extension=php_soap.dll
;extension=php_sockets.dll
;extension=php_sqlite.dll
;extension=php_sybase_ct.dll
;extension=php_tidy.dll
;extension=php_xmlrpc.dll
;extension=php_xsl.dll
;extension=php_zip.dll
;extension = php_http.dll


and my extension_dir = "C:\php\ext"

and the php_curl.dll file is there

and i have copied libeay32.dll and ssleay32.dll to c:\windows\system32

I am frazled with the situation...
:)

eelixduppy

2:47 pm on Mar 10, 2010 (gmt 0)



When did you make those changes? Perhaps a server restart is in order to reload the configuration.

eatspinach

2:52 pm on Mar 10, 2010 (gmt 0)

10+ Year Member



I restarted IIS several times but i haven't restarted the physical machine. I was hoping to not have to do that, but thanks i will keep that in mind as final roll of the dice.

eelixduppy

2:54 pm on Mar 10, 2010 (gmt 0)



I meant the web server not the box itself. Not sure what the problem is however, maybe IIS has issues with cURL. Never used IIS with cURL myself.

Anyango

3:01 pm on Mar 10, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Have you checked for File permissions? are there Execute permissions on that curl DLL. With IIS sometimes that problem is there, when permissions are not properly set, that might be the case

eatspinach

3:05 pm on Mar 10, 2010 (gmt 0)

10+ Year Member



I have noticed that the ext folder is grayed out and ticked read only, but when i untick this and click ok and check it again the tick is back again?

Anyango

3:06 pm on Mar 10, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try on that specific DLL file. i.e. php_curl.dll

eatspinach

3:10 pm on Mar 10, 2010 (gmt 0)

10+ Year Member



on the specific file it is NOT read only, so there is no tick in the read only box..

Anyango

3:22 pm on Mar 10, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This might help

[webmasterworld.com...]

eatspinach

3:39 pm on Mar 10, 2010 (gmt 0)

10+ Year Member



i tried all that and still no joy, i am going to just try a fresh install of php, does anyone know how to install php from a windows server? or does the install
VC9 x86 Thread Safe (2010-Mar-04 20:11:10) from [windows.php.net...]

take care of all that for me?

Anyango

4:38 pm on Mar 10, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Before trying a fresh install, download zip file for your php version and try to update your existing DLL from that zip, including the 2 dlls that were placed in system32

eatspinach

4:45 pm on Mar 10, 2010 (gmt 0)

10+ Year Member



i did a fresh install and now i am getting this
This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem.


so i guess this is pretty bad..