Jump to content

Curl Help Please


mcloan

Recommended Posts

I am trying to post to a form with CURL and the form has a file name specified as the following:


<input name="locator1:textPostalCode" type="text" id="locator1_textPostalCode" style="width:75px;" size="20" />


Is it correct I would make my $data variable for the post like the following?  I am concerned about the ":" in the name of $data.  Will this work with CURL?

$data="locator1:textPostalCode=77090";

[code]

$ch = curl_init();

// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURL_ERROR, 1);
curl_setopt($ch, CURLOPT_REFERER, $url);
curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt");
curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt");
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 600);
curl_setopt($ch, CURLOPT_TIMEOUT, 600);

// grab URL, and return output

$Contents = curl_exec($ch);


[code/]

[/code]
Link to comment
https://forums.phpfreaks.com/topic/31805-curl-help-please/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.