1

I'm new with cURL, I succeeded with my first request but now I'm stuck. I have the right request in C# but I don't know how to convert the second in cURL PHP.

Here is the HttpWebRequest:

var request = (HttpWebRequest)WebRequest.Create(new Uri("https://www.google.fr"));
request.Method = HttpMethod.Get;
request.Headers["X-343-Authorization-WLID"] = "v1=" + accessToken;
request.Accept = "application/json";

accessToken is a string variable of course.

David Robinson
  • 77,383
  • 16
  • 167
  • 187
antoine.lange
  • 731
  • 6
  • 24

1 Answers1

1

Here are the three base curl_setopt calls you'll need to make.

curl_setopt($ch,CURLOPT_URL,"$website");
curl_setopt($ch,CURLOPT_ENCODING, 'application/json');
curl_setopt($ch,CURLOPT_HTTPHEADER, array("X-343-Authorization-WLID:v1=$accesstoken"));

You might want to add follow_location and return_transfer, but I don't know exactly what you're doing. Both of those options are listed in the curl_setopt documentation.

That page should have enough examples to get you going.

Trenton Trama
  • 4,890
  • 1
  • 22
  • 27