bogu wrote:CURL, Client URL Library Functions
Predefined Constants
CURLOPT_POST: Set this option to a non-zero value if you want PHP to do a regular HTTP POST. This POST is a normal application/x-www-form-urlencoded kind, most commonly used by HTML forms.
Curl also has support for cookies. Cookie handling with curl is very simple. There are three options built into curl, CURLOPT_COOKIE, CURLOPT_COOKIEJAR, and CURLOPT_COOKIEFILE. CURLOPT_COOKIE is used to set a cookie for the current session. CURLOPT_COOKIEJAR stores the location of a file to store the cookies received when the session is closed. CURLOPT_COOKIEFILE stores the location of a file containing cookies written in either Netscape format or raw HTTP header style.
bogu -
Thank you for the reply. I have the CURLOPT_POST, working on this one form, but I am trying to do another form and it is not working. I have determined the site may be checking the HTTP_REFERER so I also tried using curl_setopt($ch, CURLOPT_REFERER, $url); but the post is still not working. In reviewing Live Headers I noticed there is the following line:
Cookie: CTG=1166484672; DM52091284BRV6=V1%r(#X"rz%%eeCiCe%%@@r%iez%zrze%"%%eeCiCe%%z%%eeCiCe%%"%%eeCiCe@B"%%eeCiCe%%@@r%ie"e%z(xB$FG:hfxB$_aI~ahFxB$FfIT_Ih_xB$~::dDGxBrxBimGxB^z7}z)OuKr6XrzA6FG:hf6_aI~ahF6FfIT_Ih_6~::dDGHomG9zu::dmIhd; WSS_GW=V1z%%eeCiCe%%
My guess is the site is assigning a cookie on the form and looking for this cookie on post. I tried the following lines in my code to handle the cookie, but have been unable to get them to work.
curl_setopt($ch, CURLOPT_WRITEHEADER, $cookie_new);
curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt");
Can you provide me specific guidance on how to handle the cookie with curl_setopt, I am not seeing it as I read the documentation.
Thank you.