I am using curl to do a post request to a server. The request contains xml data, the standard post headers sent by curl do not work. I have tried using the custom_request option with the whole post request inside it, but then curl adds a header after the custom_request portion. -
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $header);
^^^ the above produces a correct request, except it adds an additional set of headers after it.
I have tried sending the data in the CURLOPT_POSTFIE LDS, along with setting header values in the CURLOPT_HTTPHEA DER, but curl still sends the header values that it considers to be correct for a post request.
The following: -
$header = array("Content-type"=>"application/PTI26",
-
"Content-length"=>strlen($xml),
-
"Content-transfer-encoding"=>"text",
-
"Request-number"=>"1",
-
"Document-type"=>"Request",
-
"Interface-Version"=>"Test 1.4",
-
"Connection"=>"close");
-
-
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
-
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
-
produces this request: -
POST / HTTP/1.1
-
Host: www.foobar.org
-
Pragma: no-cache
-
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
-
Content-Length: 993
-
Content-Type: application/x-www-form-urlencoded
-
Is there some way to get more control of the header?
or
Is there another option besides curl that can handle a custom ssl certificate?
Thanks
Andrew
4 7282 Atli 5,058
Recognized Expert Expert
Hi Andrew. Welcome to The Scripts!
I haven't personally had much experience with cUrl so I'm afraid I can't help you much there. (I'm sure many of the other experts can, however)
But, you could always use sockets to send HTTP requests, giving you full control over the entire process. Check out the second example in that link.
Thanks for your reply,
I would like to use sockets, but I do not know if/how the following portion can be done: -
curl_setopt($ch, CURLOPT_SSLCERTTYPE, "PEM");
-
curl_setopt($ch, CURLOPT_SSLCERT, $clientcertpath);
-
curl_setopt($ch, CURLOPT_SSLCERTPASSWD, $clientcertpassword);
-
Never mind, now I see under the streams section that I can use fsockopen() and supply that certificate info. The second example here is somewhat close to what I need.
Thanks, wouldn't of found it wothout you.
Atli 5,058
Recognized Expert Expert
I'm glad I could help :)
Don't hesitate to post again if you have any more questions or problems we can help with.
pbmods 5,821
Recognized Expert Expert
Heya, Andrew.
Please use CODE tags when posting source code:
[CODE=php]
PHP code goes here.
[/CODE]
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Haluk Durmus |
last post by:
Hello
I checked out openssl,mm,apr,apr-util,apache 2,curl,libxml and php
from cvs.
php couse an ERROR
I did the following steps:
|
by: Chris Fortune |
last post by:
# uname -a
Linux stargate.mxc-online.net 2.4.20-021stab022.2.777-smp #1 SMP Wed Jul 28
17:12:37
MSD 2004 i686 i686 i386 GNU/Linux
I recompiled PHP with mcrypt, openssl, and curl
phpinfo(): http://www.canadiandropshipping.com/hello.php3
Does anyone know why this ssl curl test fails?
http://www.canadiandropshipping.com...t/diag_curl.php
|
by: Hans |
last post by:
Hi everybody,
I am desperately trying to log into my account at godaddy.com with PHP
and Curl and just cannot make it happen. Has anybody written a script
for this purpose?
Here is what I tried but the result is always the login page.
$curl=curl_init();
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
|
by: Dean Hallman |
last post by:
Hello,
I am developing a BHO that should add a custom HTTP header on a
specific domain only. Don't want the header globally, otherwise I
could just add a registry key.
So, on BEFORENAVIGATE2, I am canceling the current navigation and
renavigating with the new custom header using Navigate2. This usually
works fine, but in some cases (particularly when selecting a link that
starts a new window), the Navigate2 call fails.
|
by: nfhm2k |
last post by:
I've been trying to find a solution to this for quite some time now...
I even took a look at existing scripts...
Including this one...
http://groups.google.co.uk/group/comp.lang.php/browse_thread/thread/2e052386da903425/b03ec83ac55273a2?lnk=st&q=&rnum=1#b03ec83ac55273a2
Everyone on that post seems to say its to do with the cookie's, yet if
infact they had tried this script they would have found that even with
the cookies enabled this...
| |
by: sundar22in |
last post by:
Hi,
I want to access a part of file in PHP(Instead of whole file). I
understood HTTP Range header is the solution. How do we implement HTTP
Range header in PHP??? Iam using fopen() method to access a remote file
by providing the URL.
Any related links?? How it can be implemented??
Kindly Help
|
by: zorro |
last post by:
Hello there,
I can't figure out why is it that when i use an array for my postfields
it doesn't work :
this works
curl_setopt($curl, CURLOPT_POSTFIELDS, "clown=bozo" );
this doesn't
curl_setopt($curl, CURLOPT_POSTFIELDS, array('clown'=>'bozo') );
|
by: jsherk |
last post by:
I've spent HOURS searching the net for an answer to this, but can't find it...
I trying to send data using the POST method and also have the control of the browser be turned over to the website that's receiving the POST data (note that this is NOT the same as sending the data via POST method and then redirecting to the website after). I need it to work exactly like hitting the submit button on an html form, and I need it to work from PHP. It...
|
by: jeddiki |
last post by:
I am using curl and DOMDocument
to extract the links from my website.
This is my script:
require("my_functions.php");
$target_url = "http://www.support-focus.com/customer-service-software.html";
$userAgent = 'Googlebot/2.1 (http://www.googlebot.com/bot.html)';
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |