Questions tagged [php-curl]

PHP cURL extension for HTTP requests

PHP supports libcurl, a library created by Daniel Stenberg, that allows you to connect and communicate to many different types of servers with many different types of protocols. libcurl currently supports the http, https, ftp, gopher, telnet, dict, file, and ldap protocols. libcurl also supports HTTPS certificates, HTTP POST, HTTP PUT, FTP uploading (this can also be done with PHP's ftp extension), HTTP form based upload, proxies, cookies, and user+password authentication.

These functions have been added in PHP 4.0.2.

Source

1306 questions
-1
votes
1 answer
-1
votes
1 answer

curl_setopt(): You must pass either an object or an array with the CURLOPT_HTTPHEADER argument

My code: private static $API_ACCESS_KEY = 'AIzaSyDG3fYAj1uW7VB-wejaMJyJXiO5JagAsYI'; $headers = array( 'Authorization: key=' .self::$API_ACCESS_KEY, 'Content-Type: application/json'); private function useCurl(&$model, $url,…
Vinupriya
  • 1
  • 1
  • 1
  • 2
-1
votes
2 answers

Why is does php "curl" function not work correctly when called a second time?

I am using php Curl for first time This is my code : $ch = curl_init(); curl_setopt($ch,CURLOPT_URL,'http://huger.blog.ir/rss/'); curl_setopt($ch,CURLOPT_RETURNTRANSFER,true); $full = curl_exec($ch); curl_close($ch); $full = (string)$full; $l =…
Kavian Rabbani
  • 934
  • 5
  • 15
-2
votes
1 answer

Why does PHP curl returns error 6 for one website?

I'm trying to access www.alberta.ca/ with PHP curl but it returns "Curl failed with error #6: Could not resolve host", although the website is online and returns a nice 200. Here is my code: $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,…
Jeremie
  • 196
  • 1
  • 11
-2
votes
1 answer

Freelancer.com retrieving bids: HTTP 401, "You must be logged in to perform this request"

I'm having trouble understanding what I'm doing wrong interfacing with this API of Freelancer.com, retrieving bids: I'm sending a GET request to https://www.freelancer.com/api/projects/0.1/bids/?projects[]=36483622&projects[]=36483620 with the…
Jodes
  • 14,118
  • 26
  • 97
  • 156
-2
votes
1 answer

save some data in mysql on my server by curl

I want to save some data in mysql on my server by curl, my code is something like this my curl function verify_data_on_server ($user_id,$user_name,$user_code,$user_type,$user_url,$ user_email) { $ch = curl_init(); curl_setopt($ch,…
-2
votes
1 answer

Parsing JSON for making a POST request on Salesforce platform

After updated the code, now I can see the error string(148) "[{"errorCode":"APEX_ERROR","message":"System.TypeException: Invalid conversion from runtime type List to Map\n\n(BMCServiceDesk)"}]" Just to explain: I am creating an integration to open a…
Barcat
  • 163
  • 16
-2
votes
2 answers

how to send post - curl php

I would like to create a php form that will send a POST using curl. My curl curl-H "Content-Type: application/json" \ -X POST \ -d '{"Id":"1", "CreatedAt":"2020-07-15 09:00:00","CategoryName":"Kategoria1", \ …
TomB
  • 13
  • 2
-2
votes
2 answers

Restful API with Laravel

I'm developing a restful API with laravel. Authorization is done using a SECRET_KEY & PUBLIC_KEY as shown in the sample request code below. How do i retrieve the Authorization header key value from the Request? I would also appreciate links to any…
astroame
  • 389
  • 1
  • 8
  • 24
-2
votes
1 answer
-2
votes
1 answer

Function that gets the last redirection URL (Redirects made with javascript)

I know what you are thinking "there are many similar questions", but no, you are wrong. It is true that there are many questions that seek a PHP code that is able to obtain the last URL, I have based on those questions and answers to make my code,…
Carlos
  • 201
  • 2
  • 10
-2
votes
1 answer

How to convert a Curl to PHP CURL

I'm trying to convert this curl command into php: curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer API_TOKEN" \ -d '{"image": "ubuntu-16.04"}' \ https://api.hetzner.cloud/v1/servers/42/actions/rebuild Can anyone help…
-2
votes
1 answer

simplexml_load_string not converting special characters with php

i'm trying to convert xml to json with CURL request and special characters are not decoding properly. Below is my code function APIRequest($zip) { $URL = "http://www.example.com"; $options = array( CURLOPT_RETURNTRANSFER => true, //…
Sree
  • 11
  • 3
-2
votes
2 answers

PHP result usage for new file

I am requesting data from a server using couple of parameters that I take from a CSV file and it works but the output is not user-friendly. How can I print nicely the result of my PHP response? This is my script:
-2
votes
1 answer

count(): Parameter must be an array or an object that implements Countable at LINE 428 error in PHP

Am trying to save some data to an API which but I keep getting this error count(): Parameter must be an array or an object that implements Countable at LINE 428,,, the API am posting data to accepts an array of objects but in my data children…
Patweb
  • 133
  • 1
  • 10