DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Newsletter
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • AI Is Making PHP Cool Again
  • How to Set MX Records via API: Automate Email Routing Programmatically
  • I Got Tired of Debugging Curl at 2 AM, So I Built a CLI
  • Beyond Extensions: Architectural Deep-Dives into File Upload Security

Trending

  • Stop Writing Database Migration Scripts: Declarative Schema Sync for Java
  • YAGNI in the Age of AI Coding
  • How to Migrate From LangChainGo to Genkit Go
  • Should Developers Switch From SQLite to DuckDB?

Draft This article hasn't been published, so readers can't see it.

In moderation This article is waiting for review, so readers can't see it yet.

Deleted This article has been deleted, so readers can't see it.

  1. DZone
  2. Coding
  3. Languages
  4. Simple XML-RPC In PHP (using CURL)

Simple XML-RPC In PHP (using CURL)

By 
Snippets Manager
·
Sep. 15, 06 · Code Snippet
Post on X (opens in a new tab) Share on LinkedIn (opens in a new tab)
7.2K Views

Join the DZone community Save articles, join the discussion, and download Refcards and Trend Reports with a free account.

Join for free Already a member? Log in

# Using the XML-RPC extension to format the XML package
$request = xmlrpc_encode_request("weblogUpdates.ping", array("Copenhagen Ruby Brigade", "http://copenhagenrb.dk/") );

# Using the cURL extension to send it off, 
# first creating a custom header block
$header[] = "Host: rpc.technorati.com";
$header[] = "Content-type: text/xml";
$header[] = "Content-length: ".strlen($request) . "\r\n";
$header[] = $request;

$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, "http://rpc.technorati.com/rpc/ping"); # URL to post to
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); # return into a variable
curl_setopt( $ch, CURLOPT_HTTPHEADER, $header ); # custom headers, see above
curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, 'POST' ); # This POST is special, and uses its specified Content-type
$result = curl_exec( $ch ); # run!
curl_close($ch); 

echo $result;


XML-RPC CURL PHP

Opinions expressed by DZone contributors are their own.

Related

  • AI Is Making PHP Cool Again
  • How to Set MX Records via API: Automate Email Routing Programmatically
  • I Got Tired of Debugging Curl at 2 AM, So I Built a CLI
  • Beyond Extensions: Architectural Deep-Dives into File Upload Security

Partner Resources

×

Comments

Loading comments

The comments didn't load

Please try again in a moment.

Likes

Loading

The next likes didn't load. Please try again.

The likes didn't load

Please try again in a moment.

See who liked this

Log in or join DZone for free to see who liked this article.

Log in Join for free
  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook