✨ Ajoute l'upload d'images
This commit is contained in:
parent
c231b7e26b
commit
9068627e6a
@ -110,7 +110,7 @@ class Account
|
|||||||
$crawler = $this->client->request('GET', self::ADD_URL);
|
$crawler = $this->client->request('GET', self::ADD_URL);
|
||||||
file_put_contents(sprintf('%s/add.html', $log_folder), $crawler->html());
|
file_put_contents(sprintf('%s/add.html', $log_folder), $crawler->html());
|
||||||
$form = $crawler->selectButton('Valider')->form();
|
$form = $crawler->selectButton('Valider')->form();
|
||||||
$image0 = fopen(sprintf('%s/%s/image0.jpg', DEALS_DIR, $deal->getId()), 'r');
|
$image0 = sprintf('%s/%s/image0.jpg', DEALS_DIR, $deal->getId());
|
||||||
$fields = $form->getPhpValues();
|
$fields = $form->getPhpValues();
|
||||||
$fields = array_merge(
|
$fields = array_merge(
|
||||||
$fields,
|
$fields,
|
||||||
@ -135,18 +135,15 @@ class Account
|
|||||||
'subject' => $deal->getSubject(),
|
'subject' => $deal->getSubject(),
|
||||||
'body' => $deal->getBody(),
|
'body' => $deal->getBody(),
|
||||||
'price' => $deal->getPrice(),
|
'price' => $deal->getPrice(),
|
||||||
'image0' => $image0,
|
|
||||||
'no_salesmen' => 1,
|
'no_salesmen' => 1,
|
||||||
'phone_hidden' => 1,
|
'phone_hidden' => 1,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
$uri = self::UPLOAD_URL;
|
|
||||||
$this->client->request('POST', $uri, $fields, [], ['Content-Type => multipart/form-data']);
|
|
||||||
$uri = $form->getUri();
|
$uri = $form->getUri();
|
||||||
// It needs to be done twice
|
// It needs to be done twice
|
||||||
$this->client->request('POST', $uri, $fields, [], ['Content-Type => multipart/form-data']);
|
$crawler = $this->client->request('POST', $uri, $fields, ['image0' => $image0]);
|
||||||
$crawler = $this->client->request('POST', $uri, $fields, [], ['Content-Type => multipart/form-data']);
|
file_put_contents(sprintf('%s/upload-3.html', $log_folder), $crawler->html());
|
||||||
// This one doesn't wor either -> redirect to Home
|
$crawler = $this->client->request('POST', $uri, $fields, ['image0' => $image0]);
|
||||||
file_put_contents(sprintf('%s/add-2.html', $log_folder), $crawler->html());
|
file_put_contents(sprintf('%s/add-2.html', $log_folder), $crawler->html());
|
||||||
$form = $crawler->selectButton('Valider mon annonce')->form();
|
$form = $crawler->selectButton('Valider mon annonce')->form();
|
||||||
$crawler = $this->client->submit($form, ['accept_rule' => 1]);
|
$crawler = $this->client->submit($form, ['accept_rule' => 1]);
|
||||||
|
Loading…
Reference in New Issue
Block a user