0
I have a code in PHP to list a stock in OLX.
In production it works perfectly.
at Curl location is not working at all.
$url = 'https://apps.olx.com.br/autoupload/published';
$ch = curl_init($url);
$payload = json_encode(array('access_token' => $pacote['token']));
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload );
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json; charset=UTF-8'));
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($ch);
print_r(curl_getinfo($ch));
curl_close($ch);
yes, phpinfo info has Curl running:
cURL support enabled
cURL Information 7.24.0
the command print_r(curl_getinfo($ch));
has the following output.
Array ( [url] => https://apps.olx.com.br/autoupload/published [content_type] => [http_code] => 0 [header_size] => 0 [request_size] => 0 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 0 [total_time] => 0.016 [namelookup_time] => 0.016 [connect_time] => 0.016 [pretransfer_time] => 0 [size_upload] => 0 [size_download] => 0 [speed_download] => 0 [speed_upload] => 0 [download_content_length] => -1 [upload_content_length] => -1 [starttransfer_time] => 0 [redirect_time] => 0 [certinfo] => Array ( ) [primary_ip] => 54.233.83.19 [primary_port] => 443 [local_ip] => 10.25.61.90 [local_port] => 65055 [redirect_url] => )
the code $data = curl_exec($ch);
false return.
Repeating this code in production returns a list perfectly. I’m using windows 10. php 5.4.45.