Bonjour à tous.
J'ai une ligne de commande curl que j'essaye de transformer en script php mais impossible
La ligne en question:
Mon script
Code : Sélectionner tout - Visualiser dans une fenêtre à part curl -v -F login=admin -F password='XXX' -F "importcontent=test@test.fr" -F "listname[0]='cus'" -F "importlists[0]=6" -F "checkvalidity=1" 'http://www.XXX.com/lists/admin/?page=importsimple&list=6' -o curlout.html
ou
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 $url = "http://www.".$domain.".com/lists/admin/?page=importsimple&list=".$list."&login=".$username."&password=".$password; $postfields = array(); $postfields["listname[0]"] = $list_name; $postfields["importlists[0]"] = $list; $postfields["checkvalidity"] = "1"; $postfields["importcontent"] = "adresse@test.com"; $postfields["doimport"] = "submit"; $ch = curl_init($url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec($ch); curl_close($ch); echo "<hr/> ". $result. "<hr/> ";
Pourriez vous me donnez un coup de main?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 $url = "http://www.".$domain.".com/lists/admin/"; $postfields = array(); $postfields["login"] = $username; $postfields["password"] = $password; $postfields["page"]="importsimple"; $postfields["list"]=$list; $postfields["login"]=$username; $postfields["password"]=$password; $postfields["listname[0]"] = $list_name; $postfields["importlists[0]"] = $list; $postfields["checkvalidity"] = "1"; $postfields["importcontent"] = "adresse@test.com"; $postfields["doimport"] = "submit"; $ch = curl_init($url); curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec($ch); curl_close($ch); echo "<hr/> ". $result. "<hr/> ";
Partager