Jump to content
php.lv forumi

curl error


EdgarsK

Recommended Posts

Sveiki, ir nakts vidus un censhos izprast kas man ir par kljudu, ceru ka kads man palidzes.

 

1) caur CURL atveram sezonu, sanjemam cookies, execejam, aizveram sezonu

2) caur CURL atveram sezonu, izveidojam datus ko sutit caur post, ieliekam phpsess cookiju, execejam, aizveram sezonu

 

Itka viss izklausas pareizi, bet pretim sanjemu

411 - Length Required

 

Tad pievienoju (2) darbibais HTTPHEADER iedalu Content-Size: strlen(mani_postetie_dati)

Izmainu nav, joprojam 411..

ko darit ? ka pareizi sastadit httpheader ( es pienjemu ka tas ir vainigs pie error )

 

 

 

1. Atveram, sanjemam cookies, execejam, aizveram

$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,"http://www.lapa.lv");
curl_setopt($ch,CURLOPT_COOKIEJAR,dirname(__FILE__)."/cookie.ini");
curl_exec($ch);
curl_close($ch);

2. Atveram, ieliekam post datus, sesiju, execejam, aizveram

$header[] = "Content-Length: ".strlen($fields_str);
$ch = curl_init();
curl_setopt($ch,CURLOPT_POST,count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_str);
curl_setopt($ch,CURLOPT_URL,"http://www.lapa.lv");
curl_setopt($ch,CURLOPT_HTTPHEADER,$header);
curl_setopt($ch,CURLOPT_COOKIE,"PHPSESSID=$phpses");
curl_setopt($ch,CURLOPT_FOLLOWLOCATION,1);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
$body=curl_exec($ch);
curl_close($ch);

Edited by EdgarsA
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...