I am trying to extract content from a url with php.
$curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_HTTPHEADER => [ 'Content-Type: application/json', 'APIKEY: myapikeymyapikey' ], CURLOPT_RETURNTRANSFER => 1, CURLOPT_URL => 'https://autoextract.scrapinghub.com/v1/extract', CURLOPT_POST => 1, CURLOPT_POSTFIELDS => [ 'url' => 'https://blog.scrapinghub.com/gopro-study', 'pageType' => 'article' ] ]); $resp = curl_exec($curl); curl_close($curl); return $resp;
I get the error
{
title: "No authentication token provided",
type: "http://errors.xod.scrapinghub.com/unauthorized.html"
}
Try:
CURLOPT_POSTFIELDS => json_encode([[ 'url' => 'https://blog.scrapinghub.com/gopro-study', 'pageType' => 'article' ]])
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://autoextract.scrapinghub.com/v1/extract');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "[{\"url\": \"https://www.automoto.it/listino\", \"pageType\": \"vehicle\"}]");
curl_setopt($ch, CURLOPT_USERPWD, 'My Key ' . ':' . '');
curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate');
$headers = array();
$headers[] = 'Content-Type: application/json';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
$json_string = json_decode($result, true); => couldn't get all car details please help .
techytimo
I am trying to extract content from a url with php.
I get the error
{
title: "No authentication token provided",
type: "http://errors.xod.scrapinghub.com/unauthorized.html"
}
Try:
- Oldest First
- Popular
- Newest First
Sorted by Oldest Firstpromoautotest
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://autoextract.scrapinghub.com/v1/extract');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "[{\"url\": \"https://www.automoto.it/listino\", \"pageType\": \"vehicle\"}]");
curl_setopt($ch, CURLOPT_USERPWD, 'My Key ' . ':' . '');
curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate');
$headers = array();
$headers[] = 'Content-Type: application/json';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
$json_string = json_decode($result, true); => couldn't get all car details please help .
-
Scrapy send csv to emails
-
Request for refund
-
Scraping amazon products returned data not the same for every product
-
Filemaker JSON Malformed
-
Autoextract for Organisation data type
-
Request for refund
-
Unclear how AutoExtract pricing works
-
Automatic Extraction plan disabled
-
Refund request
See all 32 topics